Repository navigation
gmp: document the ValueErrors for negative and out of range arguments - #6006
Merged
Merged
Conversation
lacatoire
reviewed
Oct 23, 2026
lacatoire
reviewed
Oct 23, 2026
lacatoire
reviewed
Oct 23, 2026
lacatoire
reviewed
Oct 23, 2026
lacatoire
requested changes
Oct 23, 2026
Contributor
Author
|
Applied. Thanks. |
lacatoire
reviewed
Oct 24, 2026
lacatoire
approved these changes
Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bunch of gmp pages didn't say they throw a ValueError for negative or out of range arguments. Added Errors sections to gmp_fact, gmp_pow, gmp_powm (plus the DivisionByZeroError for a zero modulus), gmp_root, gmp_rootrem, gmp_sqrt, gmp_sqrtrem, gmp_strval, gmp_setbit, gmp_clrbit, gmp_scan0 and gmp_scan1, using the same "prior to 8.0.0 a warning was raised" line gmp_binomial has.
gmp_testbit's Errors section still described the old E_WARNING and false, so that's updated. The gmp_pow example also called gmp_pow("2", -1) and said it generates a warning, which throws now, so I took that line out.
Checked against ext/gmp/gmp.c on master, PHP-8.5, PHP-8.0 and PHP-7.4.