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

Unpacking of possibly empty arrays is not thoroughly checked #4577

Closed
Dgame opened this issue Oct 10, 2021 · 0 comments
Closed

Unpacking of possibly empty arrays is not thoroughly checked #4577

Dgame opened this issue Oct 10, 2021 · 0 comments
Labels
enhancement This improves the quality of Phan's analysis of a codebase

Comments

@Dgame
Copy link

Dgame commented Oct 10, 2021

I had the same problem with phpstan and psalm, so here is the Playground link:

https://phan.github.io/demo/?code=%3C%3Fphp%0A%0Afunction+foo%28int+%24i%2C+int+...%24is%29%3A+void%0A%7B%0A++++%24i+%2B%3D+array_sum%28%24is%29%3B%0A++++echo+%24i%3B%0A%7D%0A%0A%2F**%0A+*+%40param+int%5B%5D+%24fields%0A+*%2F%0Afunction+bar%28array+%24fields%29%3A+void%0A%7B%0A%09foo%28...%24fields%29%3B%0A%7D%0A%0Abar%28%5B%5D%29%3B

Phan does not detect an error, but as you can see here, passing an empty array results in an error.

@TysonAndre TysonAndre added the enhancement This improves the quality of Phan's analysis of a codebase label Oct 10, 2021
TysonAndre added a commit to TysonAndre/phan that referenced this issue Oct 10, 2021
Improve the detection of too many or too few arguments where the real
type is actually known.

Related to phan#4577
TysonAndre added a commit to TysonAndre/phan that referenced this issue Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This improves the quality of Phan's analysis of a codebase
Projects
None yet
Development

No branches or pull requests

2 participants