Skip to content

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

@telefoontoestel

Description

@telefoontoestel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions