|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69751 Change Error message of sprintf/printf for missing/typo position specifier
Submitted: 2015-06-03 11:59 UTC Modified: 2021-01-06 16:20 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: Closed Package: Strings related
PHP Version: 5.5.25 OS: Linux 3.13.0-53-generic
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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.
 [2021-01-06 16:14 UTC]
-Status: Open +Status: Verified
 [2021-01-06 16:14 UTC]
Yes, that error message is not right.  You also get the same error
message if the argnum is greater than INT_MAX[1].

[1] <>
 [2021-01-06 16:20 UTC]
-Type: Feature/Change Request +Type: Bug
 [2021-09-29 10:22 UTC]
Automatic comment on behalf of Flashwade1990 (author) and nikic (committer)
Log: Fix bug #69751
 [2021-09-29 10:22 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 30 04:01:25 2023 UTC