From: y dot leconte dot akis at nerim dot fr Operating system: Linux PHP version: 4.3.1 PHP Bug Type: Output Control Bug description: sprintf formatted string
Hello. I find a problem in the sprintf function when i try to format a string. example: <? $out=sprintf("%4.4s","123456789"); echo strlen($out)." - $out<BR>"; ?> result: 9 - 123456789 instead of 4 - 1234 Formats %xs and %.ys work but not format like %x.ys where x and y are numbers. The problem seems to come from the php_sprintf_appendstring function located in the ext/standard/formatted_print.c file. Putting in comment the following lines: /* if (max_width && min_width) { expprec = max_width = 0; } */ seems to resolve the problem. But i dont know the possible impacts of this modification on others zend functions. Best regards Yves -- Edit bug report at http://bugs.php.net/?id=22922&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22922&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22922&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22922&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22922&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22922&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22922&r=support Expected behavior: http://bugs.php.net/fix.php?id=22922&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22922&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22922&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22922&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22922&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22922&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22922&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22922&r=gnused