From: michael at fishnet dot us Operating system: linux 2.4.20 PHP version: 4.3.10RC2 PHP Bug Type: Output Control Bug description: printf() occasional extraneous characters
Description: ------------ printf() occasionally returns unexpected trailing characters. The problem can be difficult to reproduce, as it only rarely happens. The example URL below does show the problem. I have never isolated just what causes the format problem, though so far the extraneous characters seem to only occur in floating point formats. Others have reported the same random behaviour on the FishCart (http://fishcart.org/) support list, from which the example code below is derived. In the example URL below there is a link to view the exact PH P source that prints the page; this should allow testing the script on other servers and other versions. This server is running on 4.3.10RC2; it also happened on 4.3.10RC1, 4.3.9 and is also reproducable on a different server running 5.0.2. Reproduce code: --------------- http://www.fni.com/sprintf_4310rc2.php http://www.fni.com/sprintf_4310rc2.txt Expected result: ---------------- A few integer and floating point numbers are displayed that should show both integers and floating point numbers formatted to 2 decimal places. Actual result: -------------- When displaying 42, the printed result is 42.009. When printing 39 with 0 to 3 trailing spaces in the format string, an ascending count is displayed as follows; the increasing appended number (9, 10, 11, 12) seems to be the overall displayed string length including the $. $ 39.009 $ 39.00 10 $ 39.00 11 $ 39.00 12 See the script source code in the URL above to see exactly what code is being run. In particular, look at the page source in the browser to see how the above numbers are staggered. -- Edit bug report at http://bugs.php.net/?id=31051&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31051&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31051&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31051&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31051&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31051&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31051&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31051&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31051&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31051&r=support Expected behavior: http://bugs.php.net/fix.php?id=31051&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31051&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31051&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31051&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31051&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31051&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31051&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31051&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31051&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=31051&r=mysqlcfg
