-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpKernel] fix ErrorException in CacheWarmerAggregate #43501
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
[HttpKernel] fix ErrorException in CacheWarmerAggregate #43501
Conversation
|
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
06edb66 to
e623192
Compare
| { | ||
| $collectedLogs = []; | ||
| if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) { | ||
| $collectedLogs = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be reverted, the IDE is just missing a brain :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough, will take care of that.
Reverting that is:p
derrabus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Is it possible to write a test for that change?
Oh I hadn't looked into that actually. |
|
So @derrabus I am running into an issue here attempting to test this. The relevant codeblock is only executed when the constant |
|
I'm not sure this can be tested, because I suspect this might happen only in some race conditions. |
e623192 to
2eaa19f
Compare
I am quite sure you can replicate it without race conditions by truncating the file to size 0 before warming cache |
|
Oh, can you figure out a test case then? |
|
Yeah give me a few minutes and I'll push my testcase |
|
So without the With the |
| public function warmUp($cacheDir) | ||
| { | ||
| if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) { | ||
| if ($collectDeprecations = $this->debug && (!\defined('PHPUNIT_COMPOSER_INSTALL') || file_exists(CacheWarmerAggregateTest::$emptyFile))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert this.
I'm fine if we don't test, compared to adding it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
I commited it to show why I thought I couldn't test it, and hoped that maybe I overlooked something.
I will revert the last commit and it should be good to go
fadafdc to
2eaa19f
Compare
|
Thank you @Ahummeling. |
I ran into an
ErrorExceptionreloading after some changes. I suppose this triggered a cache warmup call. This didn't go as expected, because$previousLogs = unserialize(file_get_contents($this->deprecationLogsFilepath));set$previousLogstofalseinstead of the expected array. I think it makes sense to only callarray_mergeif$previousLogswas successfully instantiated as an array.My IDE also pointed out that
$collectedLogswas possible undefined, so moving its declaration outside of the if block resolved that.Stacktrace: