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] fix support for lazy/unset properties#44295

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

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromnicolas-grekas:ser44
Nov 28, 2021

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedNov 26, 2021
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#44273#44283
LicenseMIT
Doc PR-

This basically backports#43469 into 4.4, which is the way to go tofix#44273.
The code that exists to handle uninitialized properties is broken anyway (it was before the recent changes.)

try {
$attributeValue =$this->getAttributeValue($object,$attribute,$format,$context);
}catch (AccessException$e) {
if (sprintf('The property "%s::$%s" is not initialized.',\get_class($object),$attribute) ===$e->getMessage()) {
Copy link
Member

Choose a reason for hiding this comment

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

rather than detecting the error message (which could easily be broken if we reword the message, especially as there is no tests covering this), shouldn't we use a subclass of the AccessException instead ?
The rule until now is that the exceptionmessages are not covered by any BC rules and should not be relied upon to catch exceptions.
And this is a cross-component dependency, which would require actually changing the BC rules to allow the current pattern

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes I agree, that's what we've done on 5.3 already, but introducing a new class in 4.4 doesn't look like a good idea to me...

@nicolas-grekasnicolas-grekas merged commitdc04b8c intosymfony:4.4Nov 28, 2021
@nicolas-grekasnicolas-grekas deleted the ser44 branchNovember 28, 2021 18:07
This was referencedNov 29, 2021
This was referencedDec 29, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@stofstofAwaiting requested review from stof

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

[Serializer] [Serializer] Serializer tries to access initializer property when serializing a Doctrine Proxy object

3 participants

@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp