8000 [Serializer] Include the format in the cache key by dunglas · Pull Request #19352 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] Include the format in the cache key #19352

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Put the format in the md5() call
  • Loading branch information
dunglas committed Jul 13, 2016
commit 426b1094f84fe52ebac82bef34c3a6cb5c1f8db2
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private function isMaxDepthReached($class, $attribute, array &$context)
private function getCacheKey($format, array $context)
{
try {
return $format.'-'.md5(serialize($context));
return md5(serialize($format.$context));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not work as $context is an array, so you would always have Array and a PHP notice for the array to string conversion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, my intent was to but it before the serialize call ^^.

6AF6 Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

} catch (\Exception $exception) {
// The context cannot be serialized, skip the cache
return false;
Expand Down
0