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

[VarExporter] Fix calling scope detection inside magic accessors#51071

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:6.2fromvtsykun:fix/detect-scope
Jul 26, 2023

Conversation

@vtsykun
Copy link
Contributor

@vtsykunvtsykun commentedJul 22, 2023
edited by nicolas-grekas
Loading

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

This PR provides fixes related to detection of class scope for which the magic method was called.
this fixes are related to the issue described in this RFChttps://wiki.php.net/rfc/access_scope_from_magic_accessors

more accurate STR for the bug:

class A1Class {private$prop1;publicfunction__construct($prop1)    {$this->prop1 =$prop1;    }publicfunctiongetProp1()    {return$this->prop1;    }}class B1Classextends A1Class{protected$prop1;protected$prop2;publicfunction__construct($prop1)    {parent::__construct($prop1);$this->prop1 =$prop1;    }publicfunctiontest()    {return$this->prop1;    }publicfunctiontest2()    {return$this->prop2;    }publicfunctionsetProp2($prop2)    {$this->prop2 =$prop2;    }}
App\B1Class:arguments:[ 'test1' ]calls:            -[ setProp2, [ 'test2' ] ]lazy:true

Call$this->b1Class->test2();

Actual result:
Selection_1645

MatTheCat reacted with thumbs up emoji
@vtsykun
Copy link
ContributorAuthor

I found another type of error related to this bug

class FinalPublicClass{private$count =0;finalpublicfunctionincrement():int    {return$this->count +=1;    }publicfunctiondecrement():int    {return$this->count -=1;    }}class TestOverwritePropClassextends FinalPublicClass{publicfunction__construct(protectedstring$dep,protectedint$count    ) {    }publicfunctiongetDep():string    {return$this->dep;    }}
TestOverwritePropClass:lazy:truearguments:['123', 5]

$class->increment() // return 1,
$proxy->increment() // return 6, but must be 1

Selection_1646

@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.2Jul 26, 2023
@nicolas-grekas
Copy link
Member

Thank you@vtsykun.

@nicolas-grekasnicolas-grekas merged commitf65b0a4 intosymfony:6.2Jul 26, 2023
@vtsykunvtsykun deleted the fix/detect-scope branchJuly 26, 2023 19:31
This was referencedJul 30, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhAwaiting requested review from xabbuh

@lyrixxlyrixxAwaiting requested review from lyrixx

@dunglasdunglasAwaiting requested review from dunglas

@ycerutoycerutoAwaiting requested review from yceruto

@wouterjwouterjAwaiting requested review from wouterj

@chalasrchalasrAwaiting requested review from chalasr

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

3 participants

@vtsykun@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp