-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Remove silenced warning tiggered by PhpArrayAdapter #21167
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
Conversation
@@ -328,7 +328,7 @@ public function commit() | |||
*/ | |||
private function initialize() | |||
{ | |||
$this->values = @(include $this->file) ?: array(); | |||
$this->values = file_exists($this->file) ? include $this->file ?: array() : array(); |
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.
I would add parentheses to improve the readability of this statement.
872207c
to
b7c7927
Compare
@@ -328,7 +328,7 @@ public function commit() | |||
*/ | |||
private function initialize() | |||
{ | |||
$this->values = @(include $this->file) ?: array(); | |||
$this->values = file_exists($this->file) ? (include $this->file ?: array()) : array(); |
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.
Shouldn't it be is_file
instead? file_exists()
returns true
for directories.
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.
is_file is slower, and this is a mandatory path. there is no reason this is not a file but in severe mistakes, where the php warning will be enough a report
b7c7927
to
a9dfcd8
Compare
👍 |
…r (nicolas-grekas) This PR was merged into the 3.2 branch. Discussion ---------- [Cache] Remove silenced warning tiggered by PhpArrayAdapter | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Because many reported this silenced warning, which happens all the time unless `cache:warmup` has been run. Commits ------- a9dfcd8 [Cache] Remove silenced warning tiggered by PhpArrayAdapter
Because many reported this silenced warning, which happens all the time unless
cache:warmup
has been run.