|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41038 Problem with PHP parser in handling MIN_INT value.
Submitted: 2007-04-10 12:58 UTC Modified: 2007-04-10 13:22 UTC
From: mahesh dot vemula at in dot ibm dot com Assigned:
Status: Wont fix Package: *Compile Issues
PHP Version: 5CVS-2007-04-10 (snap) OS: RHEL 4
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: mahesh dot vemula at in dot ibm dot com
New email:
PHP Version: OS:


 [2007-04-10 12:58 UTC] mahesh dot vemula at in dot ibm dot com
The least integer value (i.e -2147483648 ) is  being treated as float(-2147483648) by the parser. var_dump(-2147483648) returns float(-2147483648).  A integer value should be treated as float, only if the value is beyond the boundary of the integer type. 
The php documentation explains the same here :  &

The Reproduce code confirms that the parser is not handling the Minimum Integer value (i.e, -2147483648) as expected. 

Operating System: RHEL 4
Linux Kernel : Linux 2.6.9
PHP Version: PHP 5.2 (Built on Apr 10, 2007 from
PHP Configure Setup: ./configure

Reproduce code:
$i = -2147483648;

$j = (int)"-2147483648";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-10 13:22 UTC]
String "-2147483648" contains two tokens: "-" and "2147483648".
Since strtol() returns ERANGE when parsing "2147483648", the result number is double.
From what I can see, changing this fact would require major changes to the parser which hopefully nobody is going to do.
Marking as "Won't fix".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 07:01:34 2024 UTC