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

[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist#28966

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

Conversation

@karser
Copy link
Contributor

@karserkarser commentedOct 24, 2018
edited by nicolas-grekas
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28961
LicenseMIT

Please take a look at the tests I added - they describe the issue. It has to do with the priorities:findAdderAndRemover('User', 'email') is called earlier than$this->isMethodAccessible('User', 'setEmail', 1)

@nicolas-grekasnicolas-grekas changed the title[PropertyAccessor][php5] Fix unable to write to singular property using setter while plural adder/remover exist[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover existOct 24, 2018
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneOct 24, 2018
@karser
Copy link
ContributorAuthor

@nicolas-grekas This bug exists in 4.1 and master, is this PR going to be merged in there as well?

@nicolas-grekas
Copy link
Member

@karser yes: we regularly merge lower branches into upper ones.

karser reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

Thank you@karser.

karser reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commit8238f16 intosymfony:3.4Nov 15, 2018
nicolas-grekas added a commit that referenced this pull requestNov 15, 2018
…y using setter while plural adder/remover exist (karser)This PR was merged into the 3.4 branch.Discussion----------[PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#28961| License       | MITPlease take a look at the tests I added - they describe the issue. It has to do with the priorities: `findAdderAndRemover('User', 'email')` is called earlier than `$this->isMethodAccessible('User', 'setEmail', 1)`Commits-------8238f16 [PropertyAccessor] Fix unable to write to singular property using setter while plural adder/remover exist
@fabpotfabpot mentioned this pull requestNov 16, 2018
This was referencedNov 26, 2018
@bendavies
Copy link
Contributor

bendavies commentedNov 26, 2018
edited
Loading

I think we have a problem here which has caused a regression, or at least a change in behaviour.

If you have a collection property which has a setter, an adder and a remover:

class Foo{private$invoices = [];publicfunctionsetInvoices(array$invoices):void    {//...    }publicfunctionaddInvoice(Invoice$invoice):void    {//...    }publicfunctionremoveInvoice(Invoice$item):void    {//...    }}

prior to this change, the adder/remover were used over the setter, but with this change, the setter is prioritized over the adder/remover.

Yes,setInvoices should behave identically toremoveInvoice(),addInvoice(), but the change in behaviour is there regardless.

Is this an intended, acceptable consequence?

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

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@karser@nicolas-grekas@bendavies@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp