From: Matt Wilmas Date: Tue, 17 Feb 2009 14:14:56 +0000 (+0000) Subject: Fixed bug #47422 (modulus operator returns incorrect results on 64 bit linux) X-Git-Tag: php-5.4.0alpha1~191^2~4253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6c4d4791c6844cd9a189861a8d4aa06b0a8dd31;p=php Fixed bug #47422 (modulus operator returns incorrect results on 64 bit linux) Removed abs(), just -1 needs to be checked (only LONG_MIN % -1 is a problem) --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index b03c441327..da735a18b5 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -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; }