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

[EventDispatcher] Correct the called event listener method case#41905

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
fabpot merged 1 commit intosymfony:4.4fromjjsty1e:patch1
Jul 4, 2021

Conversation

@jjsty1e
Copy link
Contributor

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?none
Ticketsnone
LicenseMIT
Doc PRnone

when define an event listener, if you don't specify a method, then the word case of the actual method maybe wrong, for example :

services:my_kernel_envent_listeners:class:App\EventListener\KernelListenertags:            -{ name: kernel.event_listener, event: kernel.controller_arguments }

nomethod key at this tag, then actual method called isonKernelControllerarguments, actually it should beonKernelControllerArguments, the case of word 'arguments' should be upper.

ps: only event name that has dash(_) will be affected.

ro0NL reacted with thumbs up emoji
@jjsty1e
Copy link
ContributorAuthor

sorry, it seems this PR should be filed to branch 4.4

@jjsty1e
Copy link
ContributorAuthor

failed tests😭, so hard to make a pull request, but problem indeed exists

@derrabusderrabus added this to the4.4 milestoneJun 30, 2021
@derrabus
Copy link
Member

The current behavior might be somewhat unexpected. But if we just change it, we will break existing applications. Can we make it so that both ways work?

@fabpot
Copy link
Member

Method names are case insentitive in PHP, right? So, is there a bug that needs to fix here or is it just for a better looking method name?

@derrabus
Copy link
Member

Method names are case insentitive in PHP, right?

If we don't configure a method name,RegisterListenersPass will guess it. And that logic is case-sensitive.

So, is there a bug that needs to fix here or is it just for a better looking method name?

It's about allowing a less surprising method name, I'd say.

@derrabusderrabus added the DXDX = Developer eXperience (anything that improves the experience of using Symfony) labelJun 30, 2021
@ro0NL
Copy link
Contributor

Ref#41876

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

i tend to believe it's a bugfix (as method calls are case-insensitive). Camel casing atevery word boundary, but not_, feels odd

ppl relying on case-sensitive method calls in DI config (which now changes) rely on implementation details IMHO. But 5.x would be as fine i guess 👍

@jjsty1e how did you discovered this? :D

$event['method'] ='on'.preg_replace_callback([
'/(?<=\b)[a-z]/i',
'/(?<=\b|_)[a-z]/i',
'/[^a-z0-9]/i',
Copy link
Contributor

Choose a reason for hiding this comment

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

btw this 2nd regex is a leftover fromhttps://github.com/symfony/symfony/pull/1162/files it seems, where it was replaced with empty string which now happens at L87, this happened with refactoring likely.

AFAIK it's redundant 👼

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

it confused me too, but I'm not sure we can remove

@jjsty1e
Copy link
ContributorAuthor

@jjsty1e how did you discovered this? :D

when do some breakpoint debugging in my project.

@nicolas-grekas
Copy link
Member

please apply the code style fix from fabbot

@fabpotfabpot changed the base branch from5.4 to4.4July 4, 2021 09:02
@fabpot
Copy link
Member

Thank you@jjsty1e.

@fabpotfabpot merged commite1b0be3 intosymfony:4.4Jul 4, 2021
@jjsty1e
Copy link
ContributorAuthor

@fabpot my pleasure😀

@jjsty1ejjsty1e deleted the patch1 branchJuly 4, 2021 17:39
This was referencedJul 26, 2021
@fabpotfabpot mentioned this pull requestJul 26, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

BugDXDX = Developer eXperience (anything that improves the experience of using Symfony)EventDispatcherStatus: Reviewed

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

6 participants

@jjsty1e@derrabus@fabpot@ro0NL@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp