Bug #69751 [Ver->Csd]: Change Error message of sprintf/printf for missing/typo position specifier

From: Date: Wed, 29 Sep 2021 10:22:12 +0000
Subject: Bug #69751 [Ver->Csd]: 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-236913@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: git@php.net Reported by: Hoffmann dot P at gmx dot net Summary: Change Error message of sprintf/printf for missing/typo position specifier -Status: Verified +Status: Closed Type: Bug 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: Automatic comment on behalf of Flashwade1990 (author) and nikic (committer) Revision: https://github.com/php/php-src/commit/41df5c0675daf1bb1d86e5e53e75490e3e0614bf Log: Fix bug #69751 Previous Comments: ------------------------------------------------------------------------ [2021-01-06 16:14:22] cmb@php.net 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> ------------------------------------------------------------------------ [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

« previous php.bugs (#236913) next »