Skip to content

Commit

Permalink
Merge pull request #3908 from element-code/fix-filters-route-running-…
Browse files Browse the repository at this point in the history
…twice

Filters: Fix route filters running twice
  • Loading branch information
paulbalandan authored Nov 20, 2020
2 parents 504701a + 5dba4e5 commit fc9e219
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ protected function processFilters(string $uri = null)
/**
* Maps filter aliases to the equivalent filter classes
*
* @param string $position
* @throws FilterException
*
* @return void
Expand Down Expand Up @@ -536,6 +537,11 @@ protected function processAliasesToClass(string $position)
$this->filtersClass[$position][] = $this->config->aliases[$alias];
}
}

// when using enableFilter() we already write the class name in ->filtersClass as well as the
// alias in ->filters. This leads to duplicates when using route filters.
// Since some filters like rate limiters rely on being executed once a request we filter em here.
$this->filtersClass[$position] = array_unique($this->filtersClass[$position]);
}

/**
Expand Down

0 comments on commit fc9e219

Please sign in to comment.