From: aidevelopment at gmail dot com Operating system: Linux 2.6.15-26-server PHP version: 5.2.11 PHP Bug Type: Variables related Bug description: 1 bit short of an 8 byte integer
Description: ------------ Despite having PHP_INT_MAX set to 8 bytes, It is impossible to have an int greater than 1000000000000000000000000000000000000000000000000000000000000000. 8 Byte, or 64 bit maximum should be 1111111111111111111111111111111111111111111111111111111111111111. In my included example, it is clear that when attempting to increase the value above(by adding 1), simply nothing happens. Attempting to assign a variable to a number greater than the above number produces unpredictable results. Reproduce code: --------------- <?php echo "Int Size = ".PHP_INT_SIZE." bytes.<br>"; $status = 0x7FFFFFFFFFFFFFFF; for($i=0;$i<=4;$i++) { printf ("status = '%b'<br>", $status); $status++; } ?> Expected result: ---------------- Int Size = 8 bytes. status = '111111111111111111111111111111111111111111111111111111111111111' status = '1000000000000000000000000000000000000000000000000000000000000000' status = '1000000000000000000000000000000000000000000000000000000000000001' status = '1000000000000000000000000000000000000000000000000000000000000010' status = '1000000000000000000000000000000000000000000000000000000000000011' Actual result: -------------- Int Size = 8 bytes. status = '111111111111111111111111111111111111111111111111111111111111111' status = '1000000000000000000000000000000000000000000000000000000000000000' status = '1000000000000000000000000000000000000000000000000000000000000000' status = '1000000000000000000000000000000000000000000000000000000000000000' status = '1000000000000000000000000000000000000000000000000000000000000000' -- Edit bug report at http://bugs.php.net/?id=50080&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50080&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50080&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50080&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50080&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50080&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50080&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50080&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50080&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50080&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50080&r=support Expected behavior: http://bugs.php.net/fix.php?id=50080&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50080&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50080&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50080&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50080&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50080&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50080&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50080&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50080&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50080&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50080&r=mysqlcfg