From: xoneca+phpbugs at gmail dot com Operating system: Linux 2.6.32-46-generic PHP version: 5.3.25 Package: Scripting Engine problem Bug Type: Bug Bug description:printf inconsistent parsing format string
Description: ------------ `printf` is inconsistent parsing the format string. Sometimes it throws a warning, and sometimes does not. `printf` doesn't seem to like very much single `%` chars and gets crazy. Depending on the arguments number, it will print something, or nothing. Test script: --------------- printf( '% % % %'); // or echo sprintf(...); printf( '% % % %', 10); printf( '% % % %', 10, 20); printf( '% % % %', 10, 20, 30); printf( '% % % %', 10, 20, 30, 40); printf( '% % % %', 10, 20, 30, 40, 50); // Another example: printf( '% ## %d ## % ## %d ## %d', 10, 20, 30, 40, 50); Expected result: ---------------- Throwing a warning at each call, or none at all. But not only sometimes. Actual result: -------------- php > printf( '% % % %'); PHP Warning: printf(): Too few arguments in php shell code on line 1 php > printf( '% % % %', 10); PHP Warning: printf(): Too few arguments in php shell code on line 1 php > printf( '% % % %', 10, 20); % % php > printf( '% % % %', 10, 20, 30); % % php > printf( '% % % %', 10, 20, 30, 40); % % php > printf( '% % % %', 10, 20, 30, 40, 50); % % php > // Another example: php > echo sprintf( '% ## %d ## % ## %d ## %d', 10, 20, 30, 40, 50); # 20 ## # 40 ## 50 -- Edit bug report at https://bugs.php.net/bug.php?id=64889&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64889&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64889&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64889&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64889&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64889&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64889&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64889&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64889&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64889&r=support Expected behavior: https://bugs.php.net/fix.php?id=64889&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64889&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64889&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64889&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64889&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64889&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64889&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64889&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64889&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64889&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64889&r=mysqlcfg