Skip to content

while ('0' === $str || strlen($str) !== 0) erroneously reported as "always true" #7881

@allan-simon

Description

@allan-simon

Bug report

Regression between 1.8.x-dev and 1.8.2

Code snippet that reproduces the problem

https://phpstan.org/r/5b0cb2a4-c814-4b64-9386-23d698882d56

Expected output

it should not detect the while as always true as it is false if $str = ''

Did PHPStan help you today? Did it make you happy in any way?

Yes it helped us, not only today but everyday since I've used and it's always a joy to see it reports more and more mistake, you've clearly help us saved us countless of hours of debugging :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions