phalcon/cphalcon · error · Phalcon\Http\Request\Exceptions\MissingFilters
Filters have not been defined for '{name}'
Error message
Filters have not been defined for '{name}' What it means
Request::setParameterFilters($name, array $filters, array $scope) registers sanitizers applied when the parameter is later read through the filtered getters. An empty $filters array throws MissingFilters because there would be nothing to register - Phalcon treats it as a programming/config error rather than silently ignoring the call.
Source
Thrown at phalcon/Http/Request.zep:1443
return this;
}
/**
* Sets automatic sanitizers/filters for a particular field and for
* particular methods
*
* @phpstan-param list<string> $filters
* @phpstan-param list<string> $scope
*/
public function setParameterFilters(
string name,
array filters = [],
array scope = []
) -> <static> {
var filterService, sanitizer, localScope, scopeMethod;
if unlikely empty filters {
throw new MissingFilters(name);
}
let filterService = this->getFilterService();
for sanitizer in filters {
if unlikely true !== filterService->has(sanitizer) {
throw new SanitizerNotFound(sanitizer);
}
}
if empty scope {
let localScope = [
self::METHOD_GET,
self::METHOD_PATCH,
self::METHOD_POST,
self::METHOD_PUT
];
} else {View on GitHub (pinned to b7419de9cd)
Solutions
- Skip the call when there is nothing to register: if ($filters !== []) { $request->setParameterFilters('email', $filters); }
- Fix the config source so the parameter actually declares at least one sanitizer
- Pass a real sanitizer such as ['email'] or ['trim', 'email']
Example fix
// before
$request->setParameterFilters('email', $config['filters'] ?? []); // throws when missing
// after
$filters = $config['filters'] ?? ['email'];
if ($filters !== []) {
$request->setParameterFilters('email', $filters);
} Defensive patterns
Strategy: validation
Validate before calling
if ([] === $filters) {
return; // nothing to register - skip the call
}
$request->setParameterFilters('email', $filters); Try / catch
try { $request->setParameterFilters($name, $filters); } catch (\Phalcon\Http\Request\Exceptions\MissingFilters $e) { // config gap: log and continue without filters
error_log("No filters configured for parameter {$name}");
} Prevention
- Validate config schema at boot: filters must be a non-empty list per parameter
- Keep parameter filter declarations in one config file with defaults
- Add CI checks that fail on empty filter arrays
When it happens
Trigger: setParameterFilters('email', []) - typically a filters list computed from config, a database row or user input that came back empty.
Common situations: Filter lists built from YAML/env where the key is missing; scaffolding left with an empty array; conditional code paths that produce an empty list for some parameters.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Sanitizer '{sanitizer}' does not exist in the filter locator
- A dependency injection container is required to access the '
- A null key is not allowed; bag elements must be written with
- Configuration file {fileName} cannot be loaded
- Unknown method: [{method}]
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/a4db69d9cc3c6490.
Report an issue: GitHub.