php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-06-03 11:59 UTC] Hoffmann dot P at gmx dot net
Description:
------------
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-04 12:04 UTC] cmb@php.net
-Package: SPL related +Package: Strings related
 [2015-06-04 12:04 UTC] cmb@php.net
See <http://3v4l.org/CPIng> for a corrected test script.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 03:01:30 2019 UTC