{"record":{"id":"a4db69d9cc3c6490","repo":"phalcon/cphalcon","slug":"filters-have-not-been-defined-for-name","errorCode":null,"errorMessage":"Filters have not been defined for '{name}'","messagePattern":"Filters have not been defined for '(.+?)'","errorType":"exception","errorClass":"Phalcon\\Http\\Request\\Exceptions\\MissingFilters","httpStatus":null,"severity":"error","filePath":"phalcon/Http/Request.zep","lineNumber":1443,"sourceCode":"        return this;\n    }\n\n    /**\n     * Sets automatic sanitizers/filters for a particular field and for\n     * particular methods\n     *\n     * @phpstan-param list<string> $filters\n     * @phpstan-param list<string> $scope\n     */\n    public function setParameterFilters(\n         string name,\n        array filters = [],\n        array scope = []\n    ) -> <static> {\n        var filterService, sanitizer, localScope, scopeMethod;\n\n        if unlikely empty filters {\n            throw new MissingFilters(name);\n        }\n\n        let filterService = this->getFilterService();\n\n        for sanitizer in filters {\n            if unlikely true !== filterService->has(sanitizer) {\n                throw new SanitizerNotFound(sanitizer);\n            }\n        }\n\n        if empty scope {\n            let localScope = [\n                self::METHOD_GET,\n                self::METHOD_PATCH,\n                self::METHOD_POST,\n                self::METHOD_PUT\n            ];\n        } else {","sourceCodeStart":1425,"sourceCodeEnd":1461,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Http/Request.zep#L1425-L1461","documentation":"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.","triggerScenarios":"setParameterFilters('email', []) - typically a filters list computed from config, a database row or user input that came back empty.","commonSituations":"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.","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']"],"exampleFix":"// before\n$request->setParameterFilters('email', $config['filters'] ?? []); // throws when missing\n\n// after\n$filters = $config['filters'] ?? ['email'];\nif ($filters !== []) {\n    $request->setParameterFilters('email', $filters);\n}","handlingStrategy":"validation","validationCode":"if ([] === $filters) {\n    return; // nothing to register - skip the call\n}\n$request->setParameterFilters('email', $filters);","typeGuard":null,"tryCatchPattern":"try { $request->setParameterFilters($name, $filters); } catch (\\Phalcon\\Http\\Request\\Exceptions\\MissingFilters $e) { // config gap: log and continue without filters\n    error_log(\"No filters configured for parameter {$name}\");\n}","preventionTips":["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"],"tags":["php","phalcon","filters","sanitization","request"],"backgroundTag":"missing-required-argument","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}