#46236 [Asn->Fbk]: Negative integer overflow handled incorrectly
ID: 46236
Updated by: tony2001@php.net
Reported By: wlalk at wtfs dot za dot net
-Status: Assigned
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Linux (2.6.18)
PHP Version: 5.2.6
Assigned To: tony2001
New Comment:
Cannot reproduce anything like that.
And I don't have 32bit machine for tests.
#php -r 'var_dump((int)(-PHP_INT_MAX - 10));'
int(-9223372036854775808)
#php -v
PHP 5.2.7RC3-dev (cli) (built: Oct 31 2008 19:06:58) (DEBUG)
Previous Comments:
------------------------------------------------------------------------
[2008-11-10 20:24:06] jani@php.net
Antony, your fix was not enough?
------------------------------------------------------------------------
[2008-10-05 11:22:50] wlalk at wtfs dot za dot net
Description:
------------
Large negative integer not overflowing correctly.
Same problem as Bug #38908 but with version 5.2.6.
Bug #38908 claims to have been fixed as of 26 September 2006.
Reproduce code:
---------------
echo (int)(-2432869008);
echo (int)(2432869008);
Expected result:
----------------
1862098288
-1862098288
Output as generated by a windows based server.
Actual result:
--------------
-2147483648
-1862098288
Output as generated by a linux based server.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46236&edit=1
Thread (3 messages)