#22922 [Opn->Bgs]: sprintf formatted string
| From: | moriyoshi@php.net | Date: | Thu, 27 Mar 2003 11:49:14 +0000 |
| Subject: | #22922 [Opn->Bgs]: sprintf formatted string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-36553@lists.php.net to get a copy of this message | ||
ID: 22922
Updated by: moriyoshi@php.net
Reported By: y dot leconte dot akis at nerim dot fr
-Status: Open
+Status: Bogus
-Bug Type: Output Control
+Bug Type: Strings related
Operating System: Linux
PHP Version: 4.3.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Actually dupe of bug #22224
Previous Comments:
------------------------------------------------------------------------
[2003-03-27 05:27:40] y dot leconte dot akis at nerim dot fr
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 this bug report at http://bugs.php.net/?id=22922&edit=1