|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69751 Change Error message of sprintf/printf for missing/typo position specifier
Submitted: 2015-06-03 11:59 UTC Modified: 2015-06-04 12:04 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Hoffmann dot P at gmx dot net Assigned:
Status: Open Package: Strings related
PHP Version: 5.5.25 OS: Linux 3.13.0-53-generic
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: Hoffmann dot P at gmx dot net
New email:
PHP Version: OS:


 [2015-06-03 11:59 UTC] Hoffmann dot P at gmx dot net
I suggest a more comprehensible error message (see suggestion in "Expected result"). The current error message was missunderstood by me as "The number of arguments of the function is zero (and must be greater than zero)". Instead it was the number of the position specifier argument that was missing (type, "$" and "1" where reversed).

Test script:
sprintf("%$1s, %2$s %1$s", "Sir", "Yes");

Expected result:
Missing position specifier number in /home/ber/Code/Kompetenztest/org/ValiditätEingabe/class_test.php on line $line

Actual result:
Argument number must be greater than zero in /home/ber/Code/Kompetenztest/org/ValiditätEingabe/class_test.php on line $line


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-04 12:04 UTC]
-Package: SPL related +Package: Strings related
 [2015-06-04 12:04 UTC]
See <> for a corrected test script.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 23:01:24 2020 UTC