#41038 [NEW]: Problem with PHP parser in handling MIN_INT value.
| From: | mahesh dot vemula at in dot ibm dot com | Date: | Tue, 10 Apr 2007 12:58:00 +0000 |
| Subject: | #41038 [NEW]: Problem with PHP parser in handling MIN_INT value. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-111287@lists.php.net to get a copy of this message | ||
From: mahesh dot vemula at in dot ibm dot com
Operating system: RHEL 4
PHP version: 5CVS-2007-04-10 (snap)
PHP Bug Type: *Compile Issues
Bug description: Problem with PHP parser in handling MIN_INT value.
Description:
------------
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 :
http://in.php.net/manual/en/function.intval.php
&
http://in.php.net/manual/en/language.types.integer.php
Remarks:
The Reproduce code confirms that the parser is not handling the Minimum
Integer value (i.e, -2147483648) as expected.
Environment:
Operating System: RHEL 4
Linux Kernel : Linux 2.6.9
PHP Version: PHP 5.2 (Built on Apr 10, 2007 from snaps.php.net)
PHP Configure Setup: ./configure
Reproduce code:
---------------
<?php
$i = -2147483648;
var_dump($i);
$j = (int)"-2147483648";
var_dump($j);
?>
Expected result:
----------------
int(-2147483648)
int(-2147483648)
Actual result:
--------------
float(-2147483648)
int(-2147483648)
--
Edit bug report at http://bugs.php.net/?id=41038&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41038&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41038&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41038&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41038&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41038&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41038&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41038&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41038&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41038&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41038&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41038&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41038&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41038&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41038&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41038&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41038&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41038&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41038&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41038&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41038&r=mysqlcfg