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

[PropertyAccess] Fix handling of uninitialized property of anonymous class#45002

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:fix44983
Jan 12, 2022

Conversation

@nicolas-grekas
Copy link
Member

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

@nicolas-grekas
Copy link
MemberAuthor

Thank you@filiplikavcan.

@nicolas-grekasnicolas-grekas merged commit727842f intosymfony:4.4Jan 12, 2022
@filiplikavcan
Copy link
Contributor

This also affects 5.* and 6.* version. Will this PR be merged into those branches too?

@nicolas-grekasnicolas-grekas deleted the fix44983 branchJanuary 14, 2022 09:38
@nicolas-grekas
Copy link
MemberAuthor

It is already, isn't it?

@filiplikavcan
Copy link
Contributor

Ah, ok it is.

It is not merged in 6.1 because there are conflict changes I suppose. Should I create a new PR for that or it is up to maintainers to resolve conflicts and merge it to 6.1?

@nicolas-grekas
Copy link
MemberAuthor

No need to, I'll handle the merge later on.

filiplikavcan reacted with thumbs up emoji

// handle uninitialized properties in PHP >= 7.4
if (\PHP_VERSION_ID >=70400 &&preg_match('/^Typed property ([\w\\\]+)::\$(\w+) must not be accessed before initialization$/',$e->getMessage(),$matches)) {
$r =new \ReflectionProperty($matches[1],$matches[2]);
if (\PHP_VERSION_ID >=70400 &&preg_match('/^Typed property ('.preg_quote(get_debug_type($object),'/').')::\$(\w+) must not be accessed before initialization$/',$e->getMessage(),$matches)) {
Copy link
Contributor

@filiplikavcanfiliplikavcanJan 31, 2022
edited
Loading

Choose a reason for hiding this comment

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

@nicolas-grekas

This change introduced a new bug:

class X {publicint$a; }class Yextends X {}(newY)->a;

This throws:

Typed property X::$a must not be accessed before initialization

but sinceget_debug_type(new Y) returnsY the error message does not match

Typed property Y::$a must not be accessed before initialization"

Here is a PR which fixes this:#45255

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

Reviewers

1 more reviewer

@filiplikavcanfiliplikavcanfiliplikavcan left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

3 participants

@nicolas-grekas@filiplikavcan@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp