|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22922 sprintf formatted string
Submitted: 2003-03-27 05:27 UTC Modified: 2003-03-27 05:50 UTC
From: y dot leconte dot akis at nerim dot fr Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: y dot leconte dot akis at nerim dot fr
New email:
PHP Version: OS:


 [2003-03-27 05:27 UTC] y dot leconte dot akis at nerim dot fr

I find a problem in the sprintf function when i try to format a string.


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



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-27 05:49 UTC]
Please try using this CVS snapshot:
For Windows:

Actually dupe of bug #22224
 [2003-03-27 05:50 UTC]
Non, bug #22227

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jun 03 20:03:40 2023 UTC