Do not load config from empty cache file - #46
Open
settermjd wants to merge 1 commit into
Open
Conversation
settermjd
force-pushed
the
do-not-load-cache-from-empty-cache-file
branch
from
June 19, 2024 01:38
41e67e2 to
f21e955
Compare
This change solves a fatal error that I've been encountering, whenever the cache file is present, but empty: Uncaught TypeError: Cannot assign int to property Laminas\ConfigAggregator\ConfigAggregator::$config of type array So, this change returns false if the config file is present but empty. Signed-off-by: Matthew Setter <matthew@matthewsetter.com>
settermjd
force-pushed
the
do-not-load-cache-from-empty-cache-file
branch
from
June 19, 2024 01:40
f21e955 to
3d200e8
Compare
gsteel
requested changes
Jun 19, 2024
| file_put_contents($this->cacheFile, ''); | ||
| $aggregator = new ConfigAggregator([], $this->cacheFile); | ||
|
|
||
| self::assertEmpty($aggregator->getMergedConfig()); |
Member
There was a problem hiding this comment.
shouldn't this assert an array that matches the input configuration? i.e. self::assertSame([], $aggregator->getMergedConfig()); - also, when the cache file is empty, do we expect the cache file to be updated with the now cached config?
Author
There was a problem hiding this comment.
Good question, @gsteel. I'll take another look tonight.
Member
|
Do we know why there is an empty cache file in the first place? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change solves a fatal error that I've been encountering, whenever the cache file is present, but empty:
So, this change returns
falseinloadConfigFromCache()if the config file is present but is also empty.