Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Closed

Conversation

@dunglas
Copy link
Member

@dunglasdunglas commentedApr 3, 2020
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#36332 (comment)
LicenseMIT
Doc PRn/a

serialize() can throw\Throwable with 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.

'ignored' =>$this->ignoredAttributes,
'camelized' =>$this->camelizedAttributes,
]));
}catch (\Throwable$exception) {
Copy link
Member

@nicolas-grekasnicolas-grekasApr 3, 2020
edited
Loading

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...

Copy link
MemberAuthor

@dunglasdunglasApr 3, 2020
edited
Loading

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)

Copy link
MemberAuthor

@dunglasdunglasApr 3, 2020
edited
Loading

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.

@dunglasdunglasforce-pushed theserializer-catch-throwable branch 2 times, most recently from1b8e7f0 to86ab77cCompareApril 3, 2020 14:05
@dunglasdunglasforce-pushed theserializer-catch-throwable branch from86ab77c tof4cd9a5CompareApril 3, 2020 14:06
@nicolas-grekas
Copy link
Member

nicolas-grekas commentedApr 3, 2020
edited
Loading

I openedhttps://bugs.php.net/79447
To me, this should be fixed at the PHP level instead.

dunglas reacted with heart emoji

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneApr 3, 2020
@nicolas-grekas
Copy link
Member

I've submittedphp/php-src#5396 to fix the issue on the PHP side, please have a look.

@nicolas-grekas
Copy link
Member

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@dunglas@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp