Req #69751 [Opn->Ver]: Change Error message of sprintf/printf for missing/typo position specifier
| From: | cmb@php.net | Date: | Wed, 06 Jan 2021 16:14:22 +0000 |
| Subject: | Req #69751 [Opn->Ver]: Change Error message of sprintf/printf for missing/typo position specifier | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231411@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69751&edit=1
ID: 69751
Updated by: cmb@php.net
Reported by: Hoffmann dot P at gmx dot net
Summary: Change Error message of sprintf/printf for
missing/typo position specifier
-Status: Open
+Status: Verified
Type: Feature/Change Request
Package: Strings related
Operating System: Linux 3.13.0-53-generic
PHP Version: 5.5.25
Block user comment: N
Private report: N
New Comment:
Yes, that error message is not right. You also get the same error
message if the argnum is greater than INT_MAX[1].
[1] <https://3v4l.org/gs2fF>
Previous Comments:
------------------------------------------------------------------------
[2015-06-04 12:04:54] cmb@php.net
See <http://3v4l.org/CPIng> for a corrected test script.
------------------------------------------------------------------------
[2015-06-03 11:59:13] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69751&edit=1