From: victorepand at gmail dot com Operating system: Linux PHP version: 5.2.1 PHP Bug Type: Math related Bug description: XOR problem
Description: ------------ I am finding a difference between the same bitwise arithmetic from one server to the next when using PHP. What's more, this bitwise arithmetic is necessary for the PHP script to run, so as a result it will only function on one server, but not the other. Here is an example I am using to demonstrate this: if ((43814 ^ -4738698913)!=-443704711) print "incorrect result"; else print "correct result"; The (^) operator is an XOR bitwise arithmetic function as shown here: http://us2.php.net/manual/en/language.operators.bitwise.php and I am required to use numbers like the ones shown. On one server, I have tried both PHP 4.4.0 and PHP 5.1.0RC1 and the math works correctly for both (the correct answer as shown above is -443704711). But on another server, I have tried the same math with both PHP 4.4.6 and PHP 5.2.1, and it does not work correctly with either version of PHP! The result I get at that server is: -2147439834. I have no idea what could be the problem, but I can show you the PHP Info for both servers and perhaps you can detect what might be the difference? Here is the PHP Info for the server that works correctly using PHP 5.1.0RC1: http://www.buycellularphones.info/cron/special/info.php Here is the PHP Info for the other server using PHP 5.2.1 that does not work correctly: http://www.customdesignpostcards.com/cron/special/info.php Reproduce code: --------------- if ((43814 ^ -4738698913)!=-443704711) print "incorrect result"; else print "correct result"; Expected result: ---------------- correct result Actual result: -------------- incorrect result -- Edit bug report at http://bugs.php.net/?id=41237&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41237&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41237&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41237&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41237&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41237&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41237&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41237&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41237&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41237&r=support Expected behavior: http://bugs.php.net/fix.php?id=41237&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41237&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41237&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41237&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41237&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41237&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41237&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41237&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41237&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41237&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41237&r=mysqlcfg