Skip to content

[Cache] Ensure key exists before checking array value #30621

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
Mar 27, 2019
Merged

[Cache] Ensure key exists before checking array value #30621

merged 1 commit into from
Mar 27, 2019

Conversation

jrjohnson
Copy link
Contributor

Q A
Branch? 4.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Without this fix we're getting warnings like

PHP Notice:  Undefined index: %5BOUR-KEY%5D%5B1%5D in vendor/symfony/cache/Traits/PhpFilesTrait.php on line 136

when doing a $cache->contains() in some cases. I'm having a lot of trouble tracking down exactly when and where this error will happen and what changes in our app / cache cause it, but this fix seems benign enough that maybe it can be merged without that backstory.

@nicolas-grekas nicolas-grekas added this to the 4.2 milestone Mar 25, 2019
@fabpot
Copy link
Member

fabpot commented Mar 27, 2019

Thank you @jrjohnson.

@fabpot fabpot merged commit f8b4ade into symfony:4.2 Mar 27, 2019
fabpot added a commit that referenced this pull request Mar 27, 2019
…ohnson)

This PR was merged into the 4.2 branch.

Discussion
----------

[Cache] Ensure key exists before checking array value

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Without this fix we're getting warnings like

```
PHP Notice:  Undefined index: %5BOUR-KEY%5D%5B1%5D in vendor/symfony/cache/Traits/PhpFilesTrait.php on line 136
```

when doing a `$cache->contains()` in some cases. I'm having a lot of trouble tracking down exactly when and where this error will happen and what changes in our app / cache cause it, but this fix seems benign enough that maybe it can be merged without that backstory.

Commits
-------

f8b4ade Ensure key exists before checking array value
@jrjohnson jrjohnson deleted the cache-array-key branch March 27, 2019 13:01
@fabpot fabpot mentioned this pull request Apr 2, 2019
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.

4 participants