php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46236 Negative integer overflow handled incorrectly
Submitted: 2008-10-05 11:22 UTC Modified: 2008-11-19 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: wlalk at wtfs dot za dot net Assigned: tony2001 (profile)
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.2.6 OS: Linux (2.6.18)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wlalk at wtfs dot za dot net
New email:
PHP Version: OS:

 

 [2008-10-05 11:22 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-10 20:24 UTC] jani@php.net
Antony, your fix was not enough?
 [2008-11-11 08:42 UTC] tony2001@php.net
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)
 [2008-11-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 16:01:30 2025 UTC