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

Offset does not exist on multidimensional array in very specific circumstances #4829

Closed
shorsman opened this issue Apr 9, 2021 · 2 comments
Labels
Milestone

Comments

@shorsman
Copy link

shorsman commented Apr 9, 2021

Bug report

I had an offset reported as not exisiting right after assigning a value to that offset, but only in very specific circumstances.
See code snippet below. I added comments to show when the error does or doesn't occur

Code snippet that reproduces the problem

https://phpstan.org/r/c7ca6a8c-387d-40a2-b18a-360e473e2783

Expected output

No errors

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Apr 11, 2021
@phpstan-bot
Copy link
Contributor

@shorsman After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-26: Offset 'cat3' does not exist on array('cat1' => 'blah1', 'cat2' => 'blah2', ?'cat3' => 'blah3').
+No errors

@github-actions
Copy link

github-actions bot commented Aug 5, 2021

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

No branches or pull requests

3 participants