{"record":{"id":"aebb9cfc13fd6039","repo":"phalcon/cphalcon","slug":"unknown-statement-type","errorCode":null,"errorMessage":"Unknown statement {type}","messagePattern":"Unknown statement (.+?)","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Query\\Exceptions\\UnknownPhqlStatement","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":464,"sourceCode":"                let result = this->executeUpdate(\n                    intermediate,\n                    mergedParams,\n                    mergedTypes\n                );\n\n                break;\n\n            case PHQL_T_DELETE:\n                let result = this->executeDelete(\n                    intermediate,\n                    mergedParams,\n                    mergedTypes\n                );\n\n                break;\n\n            default:\n                throw new UnknownPhqlStatement(type);\n        }\n\n        /**\n         * We store the resultset in the cache if any\n         */\n        if cacheOptions !== null {\n            /**\n             * Only PHQL SELECTs can be cached\n             */\n            if type != PHQL_T_SELECT {\n                throw new ResultsetNonCacheable();\n            }\n\n            cache->set(key, result, lifetime);\n        }\n\n        /**\n         * Check if only the first row must be returned","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L446-L482","documentation":"Query::execute()'s switch over the parsed statement type reached the default branch, meaning the PHQL statement type produced by the parser is not SELECT/INSERT/UPDATE/DELETE; UnknownPhqlStatement is thrown. The faulty input is an unsupported or unrecognized statement type in the parsed PHQL IR.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:464 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Execute only supported PHQL statements (SELECT/INSERT/UPDATE/DELETE)","Check for corrupted or hand-modified intermediate representation passed to parse()/execute()","Report unexpected types for valid statements to the framework maintainers"],"exampleFix":"if (in_array($queryType, [PHQL_T_SELECT, PHQL_T_INSERT, PHQL_T_UPDATE, PHQL_T_DELETE])) { $query->execute(); }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid passing raw IR to Query::setIR()/execute; let the parser derive it","Validate user-driven PHQL construction paths"],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}