From: philipm at sybase dot com Operating system: Linux (32-bit only) PHP version: 5.2.6 PHP Bug Type: Variables related Bug description: Large integer immediates are read incorrectly
Description: ------------ Entering a large integer immediate (i.e. bigger than INT_MAX) will result in INT_MAX being used. The issue is that these numbers cannot be treated as integers in the zval, but for some reason the parser is attempting to do so. However, the various operators convert the large number to a float, so they work okay. For example, entering: 3000000000 gives 2147483647 3000000000 + 1 gives 2147483648 3000000000.0 + 1 gives 3000000001 This issue was introduced in PHP 5.2.1 and has not been addressed as of 5.2.6. 5.2.0 and earlier worked as expected. It also appears to work properly on Windows. Reproduce code: --------------- # the output should be the same as the input print 3000000000 . "\n"; # these two should be the same print 3000000000 + 1 . "\n"; print 3000000000.0 + 1 ."\n"; Expected result: ---------------- 3000000000 3000000001 3000000001 Actual result: -------------- 2147483647 2147483648 3000000001 -- Edit bug report at http://bugs.php.net/?id=45068&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45068&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45068&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45068&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45068&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45068&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45068&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45068&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45068&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45068&r=support Expected behavior: http://bugs.php.net/fix.php?id=45068&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45068&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45068&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45068&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45068&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45068&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45068&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45068&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45068&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45068&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45068&r=mysqlcfg