Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] Catch \Throwable in getCacheKey()#36336
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
7f404b7 toea24bfcCompare| 'ignored' =>$this->ignoredAttributes, | ||
| 'camelized' =>$this->camelizedAttributes, | ||
| ])); | ||
| }catch (\Throwable$exception) { |
nicolas-grekasApr 3, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
\Exception?
catching\Throwable is a terrible practice, it hides coding issues and helps ppl lose their time to figure out what is broken...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not here, it's a very specific edge case, see#36332 (comment)
(We were already catch\Exception)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If we don't do that, if any value in the context contains a Doctrine entity, an error can be thrown, leading to a 500.
1b8e7f0 to86ab77cCompare86ab77c tof4cd9a5Comparenicolas-grekas commentedApr 3, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I openedhttps://bugs.php.net/79447 |
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedApr 16, 2020
I've submittedphp/php-src#5396 to fix the issue on the PHP side, please have a look. |
nicolas-grekas commentedApr 23, 2020
PR on php-src accepted, this is going to be fixed on PHP's side. Anyone having this issue, please upgrade to PHP >= 7.4.6. |
Uh oh!
There was an error while loading.Please reload this page.
serialize()can throw\Throwablewith PHP 7+, and it will if you try to serialize a Doctrine entity. As the serialization context will likely contain Doctrine entity, this must be caught.