ID: 41237 Updated by: [EMAIL PROTECTED] Reported By: victorepand at gmail dot com -Status: Open +Status: Feedback Bug Type: Math related Operating System: Linux PHP Version: 5.2.1 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2007-04-30 09:15:07] victorepand at gmail dot com 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 this bug report at http://bugs.php.net/?id=41237&edit=1