PHP

PHP

Made by DeepSource

Call with inconsistent number of parameters PHP-W1025

Bug risk
Critical

This issue is raised when the number of parameters passed to sprintf / sscanf / fscanf doesn't match the number of placeholders. It is recommended to make sure the number of placeholders and parameters are the same.

Bad practice

// invalid: There's only one placeholder, but two parameter values were passed
sprintf('Hello %s', 'world!', 'This is me!');
// invalid: There are no placeholders, but one parameter value has been passed
sprintf('Hello there!', 'world!');

Recommended

sprintf('Hello %s', 'world!');
sprintf('Hello there!');

References