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
Controller.Module.Action Event is case-sensitive #8422
Comments
I'm a bit surprised to are all rendered perfectly. We should always use the correct action name as defined in the code or alternatively always lowercase I don't really mind :) We should have a look why it renders all of those actions when only one should be valid |
Its because php functions are case-insensitive.
http://php.net/manual/en/functions.user-defined.php The easiest way were to convert the controller action name to lowercase. But it's maybe a BC. |
I would suggest that Edit: this may also be BC breaking for some users, but I suppose only the few who would have used the wrong case for |
If we change the ControllerResolver it can be done case-sensitive: https://github.com/piwik/piwik/blob/master/core/Http/ControllerResolver.php#L74 /** @var $controller Controller */
$controller = $this->abstractFactory->make($controllerClass);
$action = $action ?: $controller->getDefaultAction();
if (!is_callable(array($controller, $action)) || !in_array($action, get_class_methods($controller))) {
return null;
} |
👍 sounds good, should also not cause any performance issues |
Ive create a PR to fix this issue #8426 |
We could afterwards write a test that gets a list of all events (starting with |
I will add some tests |
This issue was closed via #8426 |
From my understanding this issue was fixed |
I've noticed that Events triggered by the FrontController Dispatcher are case-sensitive, but the called actions are is case-insensitive.
For example:
?module=CoreAdminHome&action=optout => triggers action CoreAdminHome:_optOut_
?module=CoreAdminHome&action=optOut => triggers action CoreAdminHome:_optOut_
?module=CoreAdminHome&action=OptOut => triggers action CoreAdminHome:_optOut_
Events:
?module=CoreAdminHome&action=optout => triggers event Controller.CoreAdminHome._optout_
?module=CoreAdminHome&action=optOut => triggers event Controller.CoreAdminHome._optOut_
?module=CoreAdminHome&action=OptOut => triggers event Controller.CoreAdminHome._OptOut_
So the docs or the behavior is wrong:
File: https://github.com/piwik/piwik/blob/master/core/FrontController.php#L492
The text was updated successfully, but these errors were encountered: