Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(s)printf fatal error not reported when params don't match placeholders #9817

Closed
kkmuffme opened this issue May 25, 2023 · 2 comments
Closed

Comments

@kkmuffme
Copy link
Contributor

When the first param of (s)printf is a literal string (otherwise not possible to validate in psalm):

https://psalm.dev/r/4be0b0cec6
The number of params - 1 must match the number of unique placeholders. Atm this reports as "no errors" while in reality this is a fatal error (ArgumentCountError)

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/4be0b0cec6
<?php

printf( '%d' );
Psalm output (using commit b99857c):

No issues!

kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 30, 2023
Fix vimeo#9819
This PR is a starting point for improving the sprintf return type and eventually validate the format, param types and param count.
(see vimeo#9817, vimeo#9818)
kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 30, 2023
Fix vimeo#9819
This PR is a starting point for improving the sprintf return type and eventually validate the format, param types and param count.
(see vimeo#9817, vimeo#9818)
kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 30, 2023
Fix vimeo#9819
This PR is a starting point for improving the sprintf return type and eventually validate the format, param types and param count.
(see vimeo#9817, vimeo#9818)
kkmuffme added a commit to kkmuffme/psalm that referenced this issue Jun 6, 2023
* check args for (s)printf for Invalid/TooMany/TooFew
* don't change the return type when we cannot infer it more specifically (nullable return)
* fix vimeo#9874
* implement vimeo#9817
* add tests
kkmuffme added a commit to kkmuffme/psalm that referenced this issue Jun 7, 2023
* check args for (s)printf for Invalid/TooMany/TooFew
* don't change the return type when we cannot infer it more specifically (nullable return)
* fix vimeo#9874
* implement vimeo#9817
* add tests
kkmuffme added a commit to kkmuffme/psalm that referenced this issue Jun 9, 2023
* check args for (s)printf for Invalid/TooMany/TooFew
* don't change the return type when we cannot infer it more specifically (nullable return)
* fix vimeo#9874
* implement vimeo#9817
* add tests
@kkmuffme
Copy link
Contributor Author

Fixed in #9841

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants