From: php at milonic dot com Operating system: Fedora/Linux 9 PHP version: 4.3.10 PHP Bug Type: Math related Bug description: Incorrect Values Returned
Description: ------------ Values returned using the following code produce different results (incorrect) in PHP-4.3.10 and PHP-4.3.9 on Fedora Core 3. When the same code is executed on a Linux 9 or FreeBSD5.3 machine the values are correct. Could be a Fedora problem but thought you'd like to take a look. Reproduce code: --------------- <? function fillZeros($a, $b){ $z = hexdec(80000000); if ($z & $a){ $a = ($a>>1); $a &= (~$z); $a |= 0x40000000; $a = ($a>>($b-1)); } else{ $a = ($a>>$b); } return $a; } function mixture($a,$b,$c) { $a -= $b; $a -= $c; $a ^= (fillZeros($c,13)); $b -= $c; $b -= $a; $b ^= ($a<<8); $c -= $a; $c -= $b; $c ^= (fillZeros($b,13)); $a -= $b; $a -= $c; $a ^= (fillZeros($c,12)); $b -= $c; $b -= $a; $b ^= ($a<<16); $c -= $a; $c -= $b; $c ^= (fillZeros($b,5)); $a -= $b; $a -= $c; $a ^= (fillZeros($c,3)); $b -= $c; $b -= $a; $b ^= ($a<<10); $c -= $a; $c -= $b; $c ^= (fillZeros($b,15)); return array($a,$b,$c); } $test= mixture("11", "22", "33"); echo "$test[0], $test[1], $test[2]\n"; ?> Expected result: ---------------- Should be: 251066875, -1654377486, -1500734959 Actual result: -------------- But instead get: 251066875, 1541925888, -402039036 Only happens on Fedora, all other boxes are fine. -- Edit bug report at http://bugs.php.net/?id=31569&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31569&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31569&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31569&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31569&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31569&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31569&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31569&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31569&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31569&r=support Expected behavior: http://bugs.php.net/fix.php?id=31569&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31569&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31569&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31569&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31569&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31569&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31569&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31569&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31569&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31569&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31569&r=mysqlcfg