Skip to content

Commit

Permalink
bug #31864 [Cache] Fixed undefined variable in ArrayTrait (eXtreme)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 4.3 branch (closes #31864).

Discussion
----------

[Cache] Fixed undefined variable in ArrayTrait

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

So once again (see #29591) my test suite managed to find an error in ArrayTrait in cache. This time it was this PR: #31395 later improved by #31590 that introduced `$id` to logging, which I guess should be `$key`? So this PR changes it to `$key`, ~but my tests **still fail** as there is no `$this->namespace` in `ArrayAdapter` (is this the only class that uses this ArrayTrait?). But I don't know what to do about it. Maybe @nicolas-grekas has some answers?~

Commits
-------

8568923 [Cache] Fixed undefined variable in ArrayTrait
  • Loading branch information
nicolas-grekas committed Jun 5, 2019
2 parents fc7ed49 + 8568923 commit e901494
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/ArrayTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function freeze($value, $key)
} catch (\Exception $e) {
$type = \is_object($value) ? \get_class($value) : \gettype($value);
$message = sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage());
CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e]);
CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]);

return;
}
Expand Down

0 comments on commit e901494

Please sign in to comment.