From: viperjason at gmail dot com Operating system: Windows XP SP2 PHP version: 5CVS-2005-11-30 (CVS) PHP Bug Type: Scripting Engine problem Bug description: Difference between echo and printf
Description: ------------ If you look at the code I initialize a 32bit hex value and print it with both printf and echo. I do a AND and a OR to get the value back to the original value and print it again with printf and echo. Printf and echo disaggree on the first print Printf and echo agree on the second print Printf and echo agree on the third print. What happened with the first print? I realize you use signed integers.....but where is my sign? Reproduce code: --------------- <? $a = 0x8000000F; printf("hex=%x, dec=%d by printf\n",$a,$a); echo $a."by echo\n"; $a = $a & 0x0FFFFFFF; printf("hex=%x, dec=%d by printf\n",$a,$a); echo $a."\n"; $a = $a | 0x80000000; printf("hex=%x, dec=%d by printf\n",$a,$a); echo $a."\n"; ?> Expected result: ---------------- I expect both printf and echo to consistantly print out the same decimal result. Actual result: -------------- The first time they didnt and second time they did. -- Edit bug report at http://bugs.php.net/?id=35497&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35497&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35497&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35497&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35497&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35497&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35497&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35497&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35497&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35497&r=support Expected behavior: http://bugs.php.net/fix.php?id=35497&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35497&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35497&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35497&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35497&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35497&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35497&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35497&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35497&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35497&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35497&r=mysqlcfg