diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index 465caeb37524..198195efd673 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -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 @@ -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]); } /**