From: tonyman_hacker at yahoo dot com Operating system: Linux PHP version: 4.3.4 PHP Bug Type: Scripting Engine problem Bug description: ~ operator produces incorrect result under Linux
Description: ------------ I've founded that under Linux the ~ bit operator doesn't produce correct result; Reproduce code: --------------- $myvar = 0x1; $myvar = ~$myvar; // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF echo dechex($myvar); Expected result: ---------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF Actual result: -------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF instead of this you could use XOR operator ... i.e. ~$myvar = $myvar ^ 0xFFFFFFFF -- Edit bug report at http://bugs.php.net/?id=27208&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27208&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27208&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27208&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27208&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27208&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27208&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27208&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27208&r=support Expected behavior: http://bugs.php.net/fix.php?id=27208&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27208&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27208&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27208&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27208&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27208&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27208&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27208&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27208&r=float