]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st
authorIlia Alshanetsky <iliaa@php.net>
Wed, 30 Jan 2008 18:27:03 +0000 (18:27 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 30 Jan 2008 18:27:03 +0000 (18:27 +0000)
argument)

NEWS
ext/gmp/gmp.c

diff --git a/NEWS b/NEWS
index 26232405ed6902eb95d6b0a1c32cc5a7f26a188c..7214e9cdc8929c1194228a65804853b42d1d509a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ PHP                                                                        NEWS
   which to group by data is specified. (Ilia)
 - Upgraded PCRE to version 7.6 (Nuno)
 
+- Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument).
+  (Ilia)
 - Fixed bug #43954 (Memory leak when sending the same HTTP status code
   multiple times). (Scott)
 - Fixed bug #43927 (koi8r is missing from html_entity_decode()). 
index 09f468d1b5766b2942fce4da7a14e953043d3fd1..6bfa9fe54ca646126c360922bee6fcd64bd272c0 100644 (file)
@@ -552,6 +552,9 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
        if (use_ui && gmp_ui_op) {
                if (allow_ui_return) {
                        long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
+                       if (mpz_sgn(*gmpnum_a) == -1) {
+                               long_result = -long_result;
+                       }
                } else {
                        gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
                }