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
Incorrectly assuming int has strlen 0 without strict types #5350
Labels
Milestone
Comments
@schlndh After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
7: Comparison operation "<" between 0 and 3 is always true.
-7: Parameter #1 $string of function strlen expects string, int given.
+7: Parameter #1 $string of function strlen expects string, int<0, 10000> given. Full report
|
@staabm After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
9: Expected type int, actual: 0
-9: Parameter #1 $string of function strlen expects string, int given.
+9: Parameter #1 $string of function strlen expects string, int<0, 10000> given. Full report
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
Since version 0.12.93 (it does not happen in 0.12.92) phpstan incorrectly assumes that
strlen
of an integer is 0 when called from a file withoutdeclare(strict_types=1)
. Casting the integer to string fixes the problem.Code snippet that reproduces the problem
https://phpstan.org/r/29a373ea-907e-44a5-a426-069ce03a5662
Expected output
Comparison operation "<" between 0 and 3 is always true.
should not be reported.The text was updated successfully, but these errors were encountered: