]> granicus.if.org Git - php/commitdiff
Fixed bug #47422 (modulus operator returns incorrect results on 64 bit linux)
authorMatt Wilmas <mattwil@php.net>
Tue, 17 Feb 2009 14:14:56 +0000 (14:14 +0000)
committerMatt Wilmas <mattwil@php.net>
Tue, 17 Feb 2009 14:14:56 +0000 (14:14 +0000)
Removed abs(), just -1 needs to be checked (only LONG_MIN % -1 is a problem)

Zend/zend_operators.c

index b03c441327c6e278babc7a55ed6f07222cb6b40f..da735a18b5df4329599564d3fe27e75bd77c1a76 100644 (file)
@@ -1523,7 +1523,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
                return FAILURE;                 /* modulus by zero */
        }
 
-       if (abs(Z_LVAL_P(op2)) == 1) {
+       if (Z_LVAL_P(op2) == -1) {
                ZVAL_LONG(result, 0);
                return SUCCESS;
        }