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 multiple parameters in isset #3601

Closed
sakarikl opened this issue Jul 14, 2020 · 1 comment · Fixed by phpstan/phpstan-src#1240
Closed

False positive with multiple parameters in isset #3601

sakarikl opened this issue Jul 14, 2020 · 1 comment · Fixed by phpstan/phpstan-src#1240
Labels
Milestone

Comments

@sakarikl
Copy link

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)

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

Successfully merging a pull request may close this issue.

2 participants