phalcon/cphalcon · error · Phalcon\Support\Debug\Exceptions\RuntimeWarning
{message}
Error message
{message} What it means
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.
Source
Thrown at phalcon/Support/Debug.zep:227
echo exception->getMessage();
return false;
}
/**
* Throws an exception when a notice or warning is raised
*
* @throws RuntimeWarning
*/
public function onUncaughtLowSeverity(
int severity,
string message,
string file,
int line
) -> void {
if error_reporting() & severity {
throw new RuntimeWarning(message, 0, severity, file, line);
}
}
/**
* Render exception to html format.
*
* @throws ReflectionException
*/
public function renderHtml(<\Throwable> exception) -> string
{
return this->renderer->render(
this->reportBuilder->build(
exception,
this->blacklist,
this->showBackTrace,
this->showFiles,
this->showFileFragment,
this->uri,View on GitHub (pinned to b7419de9cd)
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
Example fix
// before $debug->listen(true, true); // 'Undefined array key "qty"' now throws $total = $_SESSION['qty'] * $price; // after $qty = $_GET['qty'] ?? 0; // fix the notice itself $debug->listen(true, true);
Defensive patterns
Strategy: try-catch
Validate before calling
// Do not escalate severities produced by code you cannot fix (vendor). error_reporting(E_ALL & ~E_DEPRECATED); $debug = new \Phalcon\Support\Debug(); $debug->listen(true, true);
Try / catch
use Phalcon\Support\Debug\Exceptions\RuntimeWarning;
try {
echo $legacy->legacyCall(); // emits E_DEPRECATED
} catch (RuntimeWarning $e) {
// Message/file/line point at the underlying notice, not this catch block
$logger->notice($e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine()]);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Halted request
- No route matched the request.
- Class '{className}' is not an ADR Action.
- Invalid module definition for module '{moduleName}': The mod
- Module definition path '{path}' does not exist
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/352d592982aff827.
Report an issue: GitHub.