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 Fatal error: Allowed memory size of XXXXX bytes exhausted #8543
Comments
Hi there! Looks like you opened an issue without following one of the issue templates: Bug report
|
@eusonlito It looks like this is related to Larastan rather than PHPStan. It works fine if I don't include Larastan's config. So please open an issue there. |
Hello @canvural, why looks like related with Larastan? Because the .neon included? |
Because like I wrote: It works fine if I don't include Larastan's config. |
Ok! |
Ok, now I'm not so sure about it |
This is the snippet of the stack trace of the infinite recursion:
|
I believe this is related to the conditional expression changes |
I think we can fix this problem AND this bug at the same time: https://phpstan.org/r/19a13153-2263-405a-be78-55539493a439 The endless recursion comes from the fact that when we're calling But it doesn't make sense to retain readonly properties when we're reassigning the whole object, so PHPStan shouldn't ask in that case -> no more endless recursion, and the assertType failure from my example will no longer happen either. |
I only comment that this project is amazing and a basic pillar to keep the code quality of any project |
@eusonlito Thank you for your kind words! :) Fixed the problem: phpstan/phpstan-src@a7fed03 @rajyan I had to modify some conditional types tests, the results are a bit worse now, but I think the code makes more sense - if we're assigning a variable, we want to invalidate everything. |
Thank you for the fix.
Yeah, I agree with you. I left the original code, but had the same feeling. |
I have no idea why this changed :) |
@ondrejmirtes It doesn't work for me |
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
When parsing some PHP files it stuck with a recursive load and memory is drained:
Code snippet that reproduces the problem
git clone https://github.com/eusonlito/phpstan-memory-exhausted.git cd phpstan-memory-exhausted composer install php ./vendor/bin/phpstan analyse app --memory-limit=1G
payloadRow
,payloadRowIsSame
andpayloadRowOther
atapp/Domains/Log/Model/Traits/Payload.php
it workslog
atdatabase/migrations/2021_01_14_000000_base.php
it worksExpected output
Finish without error
The text was updated successfully, but these errors were encountered: