Skip to content

Commit

Permalink
only call serialize once for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 7, 2019
1 parent 7b64d88 commit a81cbc0
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -397,7 +397,11 @@ protected function createChildContext(array $parentContext, $attribute)
private function getAttributeCacheKey($format, array $context)
{
try {
return md5($format.serialize($context).serialize($this->ignoredAttributes)).serialize($this->camelizedAttributes);
return md5($format.serialize([
'context' => $context,
'ignored' => $this->ignoredAttributes,
'camelized' => $this->camelizedAttributes,
]));
} catch (\Exception $exception) {
// The context cannot be serialized, skip the cache
return false;
Expand Down

0 comments on commit a81cbc0

Please sign in to comment.