{"record":{"id":"352d592982aff827","repo":"phalcon/cphalcon","slug":"message-352d59","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"exception","errorClass":"Phalcon\\Support\\Debug\\Exceptions\\RuntimeWarning","httpStatus":null,"severity":"error","filePath":"phalcon/Support/Debug.zep","lineNumber":227,"sourceCode":"\n        echo exception->getMessage();\n\n        return false;\n    }\n\n    /**\n     * Throws an exception when a notice or warning is raised\n     *\n     * @throws RuntimeWarning\n     */\n    public function onUncaughtLowSeverity(\n        int severity,\n        string message,\n        string file,\n        int line\n    ) -> void {\n        if error_reporting() & severity {\n            throw new RuntimeWarning(message, 0, severity, file, line);\n        }\n    }\n\n    /**\n     * Render exception to html format.\n     *\n     * @throws ReflectionException\n     */\n    public function renderHtml(<\\Throwable> exception) -> string\n    {\n        return this->renderer->render(\n            this->reportBuilder->build(\n                exception,\n                this->blacklist,\n                this->showBackTrace,\n                this->showFiles,\n                this->showFileFragment,\n                this->uri,","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Support/Debug.zep#L209-L245","documentation":"With (new Debug())->listen(true, true), Phalcon registers an error handler that escalates PHP notices and warnings into exceptions: onUncaughtLowSeverity() throws Phalcon\\Support\\Debug\\Exceptions\\RuntimeWarning (extends ErrorException, carrying severity, file and line) whenever the raised severity passes the error_reporting() mask. The message is the original PHP notice/warning text — the error you see is the underlying one (e.g. 'Undefined variable $x'), now fatal to the request. It exists so weak code cannot hide behind silent notices during development.","triggerScenarios":"listen(exceptions: true, lowSeverity: true) followed by any masked E_NOTICE/E_WARNING/E_DEPRECATED: undefined array key ('Undefined array key \"qty\"'), undefined variable, division by zero, array-to-string conversion, deprecation notices from vendor packages.","commonSituations":"Enabling lowSeverity in dev to surface legacy notices; PHP 8.x upgrades where vendor code emits new deprecations; error_reporting(E_ALL) making every deprecation escalatable.","solutions":["Read the message — it names the real notice/warning; fix the code at the reported file/line (the exception carries severity/file/line)","Exclude severities you cannot fix yet: error_reporting(E_ALL & ~E_DEPRECATED) so the handler skips them (it checks error_reporting() & severity)","Listen without low severity: $debug->listen(true, false)","Keep the Debug listener out of production entirely"],"exampleFix":"// before\n$debug->listen(true, true); // 'Undefined array key \"qty\"' now throws\n$total = $_SESSION['qty'] * $price;\n\n// after\n$qty = $_GET['qty'] ?? 0; // fix the notice itself\n$debug->listen(true, true);","handlingStrategy":"try-catch","validationCode":"// Do not escalate severities produced by code you cannot fix (vendor).\nerror_reporting(E_ALL & ~E_DEPRECATED);\n\n$debug = new \\Phalcon\\Support\\Debug();\n$debug->listen(true, true);","typeGuard":null,"tryCatchPattern":"use Phalcon\\Support\\Debug\\Exceptions\\RuntimeWarning;\n\ntry {\n    echo $legacy->legacyCall(); // emits E_DEPRECATED\n} catch (RuntimeWarning $e) {\n    // Message/file/line point at the underlying notice, not this catch block\n    $logger->notice($e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine()]);\n}","preventionTips":["Fix notices and warnings as they appear — they become fatal once listen(true, true) is on","Exclude E_DEPRECATED from error_reporting when vendor packages are the source","Run CI with error_reporting(E_ALL) and a strict handler before enabling low-severity listening","Enable the Debug component in development only"],"tags":["phalcon","debug","error-handler","php-notices"],"backgroundTag":"warning-converted-to-exception","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}