diff options
-rw-r--r-- | UPGRADING | 6 | ||||
-rw-r--r-- | ext/gmp/gmp.c | 4 | ||||
-rw-r--r-- | ext/gmp/tests/gmp_clrbit.phpt | 5 | ||||
-rw-r--r-- | ext/gmp/tests/gmp_setbit.phpt | 5 |
4 files changed, 13 insertions, 7 deletions
@@ -31,9 +31,13 @@ PHP X.Y UPGRADE NOTES around. - DBA - . dba_delete() now returns false if the key was not found for the inifile + . dba_delete() now returns false if the key was not found for the inifile handler, too. +- GMP + . gmp_setbit() and gmp_clrbit() now return FALSE for negative indices, making + them consistent with other GMP functions. + ======================================== 2. New Features ======================================== diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 18e7965199..320ac3eb92 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1849,7 +1849,7 @@ ZEND_FUNCTION(gmp_setbit) if (index < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); - return; + RETURN_FALSE; } gmpnum_a = GET_GMP_FROM_ZVAL(a_arg); @@ -1876,7 +1876,7 @@ ZEND_FUNCTION(gmp_clrbit) if (index < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Index must be greater than or equal to zero"); - return; + RETURN_FALSE; } gmpnum_a = GET_GMP_FROM_ZVAL(a_arg); diff --git a/ext/gmp/tests/gmp_clrbit.phpt b/ext/gmp/tests/gmp_clrbit.phpt index 079d5d669f..0aab89dd37 100644 --- a/ext/gmp/tests/gmp_clrbit.phpt +++ b/ext/gmp/tests/gmp_clrbit.phpt @@ -10,7 +10,7 @@ gmp_clrbit($n, 0); var_dump(gmp_strval($n)); $n = gmp_init(-1); -gmp_clrbit($n, -1); +var_dump(gmp_clrbit($n, -1)); var_dump(gmp_strval($n)); $n = gmp_init("1000000"); @@ -35,10 +35,11 @@ gmp_clrbit(); echo "Done\n"; ?> ---EXPECTF-- +--EXPECTF-- string(1) "0" Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d +bool(false) string(2) "-1" Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d diff --git a/ext/gmp/tests/gmp_setbit.phpt b/ext/gmp/tests/gmp_setbit.phpt index 99848959d5..2eac23db0e 100644 --- a/ext/gmp/tests/gmp_setbit.phpt +++ b/ext/gmp/tests/gmp_setbit.phpt @@ -10,7 +10,7 @@ gmp_setbit($n, 10, -1); var_dump(gmp_strval($n)); $n = gmp_init(5); -gmp_setbit($n, -20, 0); +var_dump(gmp_setbit($n, -20, 0)); var_dump(gmp_strval($n)); $n = gmp_init(5); @@ -41,10 +41,11 @@ gmp_setbit($a,array()); echo "Done\n"; ?> ---EXPECTF-- +--EXPECTF-- string(2) "-1" Warning: gmp_setbit(): Index must be greater than or equal to zero in %s on line %d +bool(false) string(1) "5" string(1) "1" string(1) "7" |