{"record":{"id":"76231b411402d4d7","repo":"phalcon/cphalcon","slug":"halted-request","errorCode":null,"errorMessage":"Halted request","messagePattern":"Halted request","errorType":"exception","errorClass":"Phalcon\\Support\\Debug\\Exceptions\\RequestHalted","httpStatus":null,"severity":"error","filePath":"phalcon/Support/Debug.zep","lineNumber":121,"sourceCode":"        return this->renderer;\n    }\n\n    /**\n     * Generates a link to the current version documentation\n     */\n    public function getVersion() -> string\n    {\n        return this->renderer->getVersion();\n    }\n\n    /**\n     * Halts the request showing a backtrace\n     *\n     * @throws RequestHalted\n     */\n    public function halt() -> void\n    {\n        throw new RequestHalted();\n    }\n\n    /**\n     * Listen for uncaught exceptions and non silent notices or warnings\n     */\n    public function listen(\n        bool exceptions = true,\n        bool lowSeverity = false\n    ) -> <static> {\n        if exceptions {\n            this->listenExceptions();\n        }\n\n        if lowSeverity {\n            this->listenLowSeverity();\n        }\n\n        return this;","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Support/Debug.zep#L103-L139","documentation":"Phalcon\\Support\\Debug is the development exception/trace renderer. halt() deliberately throws Phalcon\\Support\\Debug\\Exceptions\\RequestHalted (\"Halted request\") to abort the request and show a backtrace — it is Phalcon's equivalent of a breakpoint with a pretty trace page. The exception is the mechanism, not a defect: wherever you call it, execution stops there.","triggerScenarios":"Calling (new Debug())->halt() inside a controller action or service while tracing a bug, then forgetting it; halt() left in code paths that later run in CI or production.","commonSituations":"Debug statements surviving into deployed code; intermittent halt() calls behind feature flags aborting requests for a subset of users.","solutions":["Remove the halt() call once tracing is done — it has no production purpose","Guard it with an environment check so it can never fire outside development","If one is left in code, catch RequestHalted in the global handler and convert it to a normal response"],"exampleFix":"// before\n$debug->halt(); // fires in every environment\n\n// after\nif (($_ENV['APP_ENV'] ?? 'production') === 'development') {\n    $debug->halt();\n}","handlingStrategy":"validation","validationCode":"$debug = new \\Phalcon\\Support\\Debug();\n\nif (($_ENV['APP_ENV'] ?? 'production') === 'development') {\n    $debug->listen();\n    $debug->halt(); // intentional breakpoint, dev only\n}","typeGuard":null,"tryCatchPattern":"use Phalcon\\Support\\Debug\\Exceptions\\RequestHalted;\n\ntry {\n    $debug->halt();\n} catch (RequestHalted $e) {\n    $response\n        ->setContent('Request halted for debugging')\n        ->send();\n}","preventionTips":["Search the codebase for '->halt(' as part of the pre-deploy checklist","Instantiate Phalcon\\Support\\Debug only behind an environment check in bootstrap","Prefer real debugger breakpoints (Xdebug) over halt() when the workflow allows"],"tags":["phalcon","debug","halt","breakpoint"],"backgroundTag":"debug-halt-in-production","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}