ID:               47422
 Updated by:       [email protected]
 Reported By:      d_kelsey at uk dot ibm dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Linux 64Bit
 PHP Version:      5.2CVS-2009-02-17 (CVS)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks. Actually, just -1 needs to be checked there anyway, since only
when doing LONG_MIN % -1 (in PHP, "(-PHP_INT_MAX - 1) % -1;") would
there be a crash/error (which that's there to catch of course).


Previous Comments:
------------------------------------------------------------------------

[2009-02-17 12:36:14] d_kelsey at uk dot ibm dot com

Description:
------------
on a 64bit system the following 
var_dump(1%4294967295);
should return 1, but returns 0. 
The problem is in the 
ZEND_API int mod_function(...) in zend_operators.c

A call is made to abs which expects a 32bit int and returns a 32bit
int, but 4294967295 is > 32 bits in size so the abs call returns an
incorrect value.

A proposed fix is to change the line
"if (abs(op2->value.lval) == 1) {"
to
"if (op2->value.lval == 1 || op2->value.lval == -1) {"



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47422&edit=1

Reply via email to