Skip to content

Clean up sprintf invalid arg type warnings found by phpstan-strict-rules - #1673

Merged
cpeel merged 5 commits into
DistributedProofreaders:masterfrom
bpfoley:strict-sprintf
Oct 5, 2026
Merged

cpeel merged 5 commits into
DistributedProofreaders:masterfrom
bpfoley:strict-sprintf

Conversation

@bpfoley

@bpfoley bpfoley commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Including one pair of bugs.

Caught by phpstan-strict-rules's sprintf checks.
I guess nobody has been editing team icons or avatars!
Unfortunately this wouldn't catch the previous swapped sql args bug,
because `sprintf("... WHERE id=%d", $str) produces "WHERE id=0" which
is valid sql, but not a valid team ID.

Nonetheless, we are now exercising this code path.
...to make phpstan-strict-rules happy.
This code seems highly suspicious to me, and looks like it might be
achieving the right effect in the wrong way, but I don't want to look
at it right now, so leave some breadcrumbs for future-Brian, and
preserve the existing behaviour.
@cpeel
cpeel merged commit 24ab5b3 into DistributedProofreaders:master Oct 5, 2026
12 checks passed
@bpfoley
bpfoley deleted the strict-sprintf branch October 5, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants