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

Caching edge case when there is missing symbol #4495

Closed
tomasfejfar opened this issue Feb 5, 2021 · 6 comments
Closed

Caching edge case when there is missing symbol #4495

tomasfejfar opened this issue Feb 5, 2021 · 6 comments

Comments

@tomasfejfar
Copy link
Contributor

Bug report

PHPStan - PHP Static Analysis Tool 0.12.65 (not the latest, but close I guess)

When there is missing symbol, the cache is not invalidated when the symbol appears elsewhere.

Code snippet that reproduces the problem

(ain't that simple)

  • let there be a class MyClass, that uses Guzzle and contains RequestOptions::ALLOW_REDIRECTS somewhere in the code
  • you checkout the branch containing the above code and run phpstan
  • cache is saved with ~ Access to undefined constant RequestOptions::ALLOW_REDIRECTS. in the file MyClass.php
  • you notice that this is caused by missing library and run composer install

Expected output

  • now that the symbol is known, there is no error

Actual output

  • the cache remains in place (I assume that because the file with the error has not changed) and the violation is reported again
  • you need to find out that the cache is the culprit and remove it

Is this expected behavior?

@mergeable
Copy link

mergeable bot commented Feb 5, 2021

This bug report is missing a link to reproduction on phpstan.org.

It will most likely be closed after manual review.

@tomasfejfar
Copy link
Contributor Author

Yes, sorry. I don't think it can be reproduced in sandbox with cache :(

@ondrejmirtes
Copy link
Member

The result cache is invalidated when composer.lock changes. It doesn't invalidate if something changes in vendor/ without changing the lock file. So if you run PHPStan and only then composer install, the cache currently doesn't get invalidated.

But I looked into it and decided to add the installed versions to metadata too: phpstan/phpstan-src@f11c0f0

Please test dev-master with the workflow above to see if it helps in your use case.

@ondrejmirtes
Copy link
Member

Now released in 0.12.72.

@tomasfejfar
Copy link
Contributor Author

Thanks, will check it!

@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 Apr 30, 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