Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Argnum dollar sign seemed to be missing. The
2
in%2s
is really a width argument.What?
Unless the 2nd and 3rd sprintf() arguments (both referenced using
%2s
) in this line of code really need to have a width of at least 2 chars, there's a typo here, and%2$s
and%3$s
were meant (and%1$s
where%1s
was used). See also https://www.php.net/manual/en/function.sprintf.php (compare theargnum$
andwidth
arguments).Why?
In this case, the bug is mostly harmless, as link targets or author names will almost always have a length of more than 2. Meaning
%2s
is equivalent to%s
and no padding will take place.But the code is confusing, because it really looks like
%2$s
was meant instead. It kind of looks like there are more such occurrences in WordPress' code, too, but lets start small.How?
Added missing dollar sign, fixed 3rd sprintf arg.
Testing Instructions
For most (all?) practical cases, there will be no change in output. But using, e.g.,
%3s
is confusing and may lead to errors in other situations (where%3$s
was meant instead), if the argument order is ever changed (like in translated strings).