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

Phpstan thinks string is not empty when running strpos #7166

Closed
simPod opened this issue May 2, 2022 · 5 comments · Fixed by phpstan/phpstan-src#1275
Closed

Phpstan thinks string is not empty when running strpos #7166

simPod opened this issue May 2, 2022 · 5 comments · Fixed by phpstan/phpstan-src#1275
Labels
Milestone

Comments

@simPod
Copy link
Contributor

simPod commented May 2, 2022

Bug report

Phpstan says the !== '' is useless but it is not, the string can be empty https://3v4l.org/3EtlO

Code snippet that reproduces the problem

https://phpstan.org/r/109cdd5b-38e1-4270-80c5-14958f8ac606

@simPod simPod changed the title Phpstan thinks string is not empty when running strlen Phpstan thinks string is not empty when running strpos May 2, 2022
@ondrejmirtes
Copy link
Member

/cc @staabm this is wrong: https://phpstan.org/r/263d49fd-8edf-4826-a20d-3a404cd3fb64

Most likely the cause is the $context not being checked for ->true() or ->false().

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone May 2, 2022
@staabm
Copy link
Contributor

staabm commented May 2, 2022

Will look into it, after my holiday (will take a week)

@herndlm
Copy link
Contributor

herndlm commented May 3, 2022

Enjoy your vacation, I'll take a quick look too later.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#1275

@github-actions
Copy link

github-actions bot commented Jun 4, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants