ID: 30695 User updated by: php_bug at cklowe dot com Reported By: php_bug at cklowe dot com -Status: Bogus +Status: Open Bug Type: Math related Operating System: Win32 PHP Version: 4CVS-2004-11-05 (stable) New Comment:
This is a change in behaviour. In version 4.3.8 (for example) the expected result is displayed. In the snapshot of a week ago, the actual result was displayed. This is *not* a signed/unsigned integer problem (sorry if my description was unclear). It is an initialization from a numeric literal problem. Saturation to 0x7fffffff should not occur. If you like, 0x80000000 should be treated as -2147483648. Having (say) 0x80000000 treated as any ther value than 0x80000000 is surely wrong. Forgive me for reopening this bug, but I fear I must. Previous Comments: ------------------------------------------------------------------------ [2004-11-10 18:16:01] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php PHP does not support unsigned integers. ------------------------------------------------------------------------ [2004-11-05 18:35:57] php_bug at cklowe dot com Description: ------------ Large integers are being saturated to the maximum signed value (0x7fffffff) as opposed to being treated as the unsigned values. Panic! I had code that set the high bit in a Permissions variable when some condition was met. After changing PHP versions because of bug 25570, I found user reports of "Why have I got all these additional permissions?" and "I've now got Admin rights, OOoooh. What happens if I run this SQL query in the page I now have access to?". Reproduce code: --------------- define ("BIG_NUM", 0x80000000); $big_var = 0x80000000; echo sprintf("%08x, %08x", BIG_NUM, $big_var); Expected result: ---------------- 80000000,80000000 Actual result: -------------- 7fffffff, 7fffffff ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30695&edit=1