Skip to content
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

Bug: Filters applied in registered order instead of requested order #85

Open
telefoontoestel opened this issue May 17, 2018 · 0 comments

Comments

@telefoontoestel
Copy link

telefoontoestel commented May 17, 2018

In the method Phroute\Phroute\Dispatcher->parseFilters the applicable before and after filters are calculated using the array_intersect_key function. The order in which the arguments are passed will result in the case that the order in which the filters are registered are leading. This is unexpected and should be the order in which the filters are requested when adding a route or group.

Proposed solution:
$beforeFilter = array_intersect_key($this->filters, array_flip((array) $filters[Route::BEFORE]));
should be
$beforeFilter = array_intersect_key(array_flip((array) $filters[Route::BEFORE]), $this->filters);

Same goes for the afterFilters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant