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

False positive with substr_count #5513

Closed
enumag opened this issue Aug 23, 2021 · 2 comments
Closed

False positive with substr_count #5513

enumag opened this issue Aug 23, 2021 · 2 comments

Comments

@enumag
Copy link
Contributor

enumag commented Aug 23, 2021

Bug report

substr_count() can't return a negative integer. Somehow PHPStan knows that on PHP 7 but not on PHP 8.

Code snippet that reproduces the problem

https://phpstan.org/r/1a52b064-480a-4891-826a-64f4f833ea41

Expected output

No error.

@ondrejmirtes
Copy link
Member

It's the opposite. PHP 7 doesn't require that argument to be int<0, max>.

Fixed the signature of substr_count: phpstan/phpstan-src@8db058a

@github-actions
Copy link

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 Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants