1.2.997. Printf Number Of Arguments¶
The number of arguments provided to printf(), vprintf() and vsprintf() doesn’t match the format string.
Extra arguments are ignored, and are dead code as such. Missing arguments are reported with a warning, and nothing is displayed.
Omitted arguments produce an error.
<?php
// not enough arguments
printf(' a %s ', $a1);
// OK
printf(' a %s ', $a1, $a2);
// too many arguments
printf(' a %s ', $a1, $a2, $a3);
// not enough arguments
sprintf(' a %s ', $a1);
// OK
\sprintf(' a %s ', $a1, $a2);
// too many arguments
sprintf(' a %s ', $a1, $a2, $a3);
?>
See also printf, sprintf and vsprintf.
1.2.997.2. Connex PHP features¶
1.2.997.2.1. Suggestions¶
Sync the number of argument with the format command
1.2.997.2.2. Specs¶
Short name |
Structures/PrintfArguments |
Rulesets |
|
Exakat since |
1.0.1 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Medium |
Examples |
|
Available in |