|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-21 09:55 UTC] z-php at bart dot w-wa dot pl
Description:
------------
"printf(): Too few arguments in..." is a warning, not an error. Yet, printf with too few arguments produces no output at all. IMHO, it should assume missing arguments to be NULL
(empty string, 0 etc.).
Reproduce code:
---------------
printf('This will not print anything at all %s');
Expected result:
----------------
output: "This will not print anything at all "
Actual result:
--------------
Output: nothing. Only warning message if you have them turned on.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 21:00:01 2025 UTC |
Formatted printing is a functionality shared by many internal functions in the printf family, this is not something we want to change obviously. Knowing this, we cannot assume anything if there are not enough arguments, since if not enough arguments are provided then there is no way to tell if the arguments received are in the correct order. vsprintf("Hello %s, %s", ["World", "From PHP"]); vsprintf("Hello %s, %s", ["From PHP"]); Assuming missing arguments are null would result in printing utter nonsense in a lot of cases. Sorry about the wait.