Skip to content

[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

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

nicolas-grekas
Copy link
Member

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.

@@ -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();
Copy link
Member

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.

@@ -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();
Copy link
Member

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.

Copy link
Member Author

@nicolas-grekas nicolas-grekas Jan 5, 2017

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

@stof
Copy link
Member

stof commented Jan 5, 2017

👍

@nicolas-grekas nicolas-grekas merged commit a9dfcd8 into symfony:3.2 Jan 5, 2017
nicolas-grekas added a commit that referenced this pull request Jan 5, 2017
…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
@nicolas-grekas nicolas-grekas deleted the cache-silence branch January 5, 2017 17:49
@fabpot fabpot mentioned this pull request Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants