|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38908 big NEGATIVE integers won't overflow on Linux
Submitted: 2006-09-21 04:14 UTC Modified: 2006-09-28 11:43 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: golikov at hotmail dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 5.1.6 OS: Linux (2.6.9-34.0.2.ELsmp)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: golikov at hotmail dot com
New email:
PHP Version: OS:


 [2006-09-21 04:14 UTC] golikov at hotmail dot com
If big negative number (-3032250090012579) is converted to integer, php 5.1.6 does not overflow on LINUX and uses max negative integer value (-2147483648) instead. Though on Windows it works as ok. Related bug #30315.

Reproduce code:
$a2 = 2224955379988029;
echo "$a2 => (int)" . (int)$a2 . "\n";
$a3 = -2224955379988029;
echo "$a3 => (int)" . (int)$a3 . "\n";

Expected result:
2.224955379988E+015 => (int)-888097219
-2.224955379988E+015 => (int)888097219

Actual result:
2.22495537999E+15 => (int)-888097219
-2.22495537999E+15 => (int)-2147483648


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-28 11:43 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 16 12:03:37 2021 UTC