Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Commit196c99e
committed
bug#60122 [Cache] ArrayAdapter serialization exception clean $expiries (bastien-wink)
This PR was submitted for the 7.3 branch but it was merged into the 6.4 branch instead.Discussion----------[Cache] ArrayAdapter serialization exception clean $expiries| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues |Fix#60121| License | MITIn [ArrayAdapter.php:339](https://github.com/symfony/symfony/blame/7.3/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php#L339), if $value contains a Closure, an Exception is triggered and $this->values get cleaned.``` try { $serialized = serialize($value); } catch (\Exception $e) { unset($this->values[$key], $this->expiries[$key], $this->tags[$key]); $type = get_debug_type($value); $message = \sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage()); CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); return null; }```$this->expiries is used in [ArrayAdapter.php:300](https://github.com/symfony/symfony/blame/7.3/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php#L300) to determine cache hit. If hash is found in $this->expiries but missing in $this->keys it generate a NOTICE.On serialize($value); catch Exception, clean expiries with unset.Commits-------91331e1 Add testsa4bfce3 bug#60121[Cache] ArrayAdapter serialization exception clean $expiriesFile tree
2 files changed
+14
-1
lines changed- src/Symfony/Component/Cache
- Adapter
- Tests/Adapter
2 files changed
+14
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
312 | 312 |
| |
313 | 313 |
| |
314 | 314 |
| |
315 |
| - | |
| 315 | + | |
316 | 316 |
| |
317 | 317 |
| |
318 | 318 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
105 | 118 |
|
0 commit comments
Comments
(0)