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
php opcache problem (Class not found errors) #7151
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
I’m not surprised by that, it’s caused by AutoloadSourceLocator, but at least the PHPStan analysis itself should be fine and not affected by this. |
This should leave the cache uncorrupted after PHPStan run: phpstan/phpstan-src@fc251b4 Please test it as phpstan/phpstan 1.6.x-dev once this is finished: https://github.com/phpstan/phpstan-src/actions/runs/2243593935 Thanks. |
As for the actual PHPStan analysis being affected, it'f be nice if you could replicate that in a repository:
Thanks. |
It depends, I see the same problem in PHPStan, if I cancel the execution and start the PHPStan process again, I see similar errors in PHPStan itself. But yes, otherwise PHPStan is running fine and "only" the next PHP calls are failing.
opcache_reset (https://www.php.net/manual/en/function.opcache-reset.php): "This function only resets in-memory cache, not the file cache." ... so it maybe helps for in memory opcache issues, but in the CLI it makes more sense to use
I already tried that but if I start the same LXC container e.g. on my local Ubuntu, I do not see the problem. :-/ I can manually remove the opcache PS: thanks for the prompt answer :) |
Alright, reverted that opcache_reset commit. My thinking is that your issues must be caused by one of the following:
Can you confirm/deny that? |
Maybe its related to a open php-bug, which can lead to autoloading issues, when files error and opcache is used. See php/php-src#8063 |
Not really, the problem is described and attempted to solve here (but it's not really possible, no one figured out how yet): phpstan/phpstan-src#801 |
Manually remove the opcache |
So couldn't phpstan itself delete the opcache files? |
I might have figured it out! Can you please try 1.6.x-dev once it builds? Thanks! |
Please test PHPStan 1.6.4 :) |
I tested PHPStan 1.6.4, and I still see the same problem. I will manually remove the opcache for now because then it's working. |
Would be nice if you could reproduce the problem. |
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. |
Bug report
I see "Class not found errors" e.g.
Class 'Arrayy\TypeCheck\TypeCheckInterface' not found
after or while running PHPStan. In this case, I try to run PHP-CS-Fixer after PHPStan, and it seems that PHP generated broken opcache files, so that PHP-CS_Fixer could not run anymore.Here is the content of an empty/broken? opcache file. (there should be more content in the file, or?)
Link to the real file: https://github.com/voku/Arrayy/blob/master/src/TypeCheck/TypeCheckInterface.php
I only saw the problem because I used
strace
to analyze the problem, and I noticed that PHPStan tried to load the opcache file of the missing class. e.g.But it seems random what opcache files are broken after a PHPStan analyse run. :-/ Any idea what I could do to debug that?
System-Info
Did PHPStan help you today? Did it make you happy in any way?
I like to prevent bugs before they hit production, and PHPStan do a wonderful work on that front. :)
The text was updated successfully, but these errors were encountered: