Skip to content

False positive with multiple parameters in isset #3601

@sakarikl

Description

@sakarikl

Bug report

if (rand(0, 1)) {
    $a = 'b';
}

if (rand(0, 1)) {
    $c = ['b' => 'everything is fine'];
}

if (isset($a, $c, $c[$a])) {
    echo $c[$a];
}

Variable $a might not be defined.

https://phpstan.org/r/718a84cf-24ba-449d-b364-d8c20bc8e7ed

Expected output

Expected no errors

if done with two different issets works as expected (https://phpstan.org/r/7d472ba3-ec9e-4f08-8566-bccebced30bb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions