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

Appearance settings

correct the called event listener method case #41876

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jjsty1e
Copy link
Contributor

@jjsty1e jjsty1e commented Jun 28, 2021

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? none
Tickets none
License MIT
Doc PR none

I found that the actual method's case of event listener was wrong, when no method was specified, for example, event name: kernel.controller_arguments, expected default method name: onkernelControllerArguments, actual method called: onKernelControllerarguments, but actually it's ok, php is case-insenstive for function call.

ps, a service.yaml example:

services:
  my_kernel_envent_listeners:
        class: App\EventListener\KernelListener
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
            - { name: kernel.event_listener, event: kernel.controller_arguments } # no `method` at this tag, then actual method called is 'onKernelControllerarguments'

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@jjsty1e
Copy link
Contributor Author

jjsty1e commented Jun 28, 2021

this changes no need extra tests.

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

failures related

i prefer a new test in RegisterListenersPassTest as well

@@ -81,7 +81,7 @@ public function process(ContainerBuilder $container)

if (!isset($event['method'])) {
$event['method'] = 'on'.preg_replace_callback([
'/(?<=\b)[a-z]/i',
'/(?<=[\b\._])[a-z]/i',
Copy link
Contributor

Choose a reason for hiding this comment

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

\b !== [\b]

Copy link
Contributor Author

@jjsty1e jjsty1e Jun 29, 2021

Choose a reason for hiding this comment

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

I will check it later, but I replaced \b with [\b\._], this will match three elements, which make kernel.controller_arguments to be KernelControllerArguments, the origin result is KernelControllerarguments and the case of word after _ is wrong

@jjsty1e
Copy link
Contributor Author

jjsty1e commented Jul 1, 2021

closed, go #41905

@jjsty1e jjsty1e closed this Jul 1, 2021
@jjsty1e jjsty1e deleted the patch-1 branch July 1, 2021 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.