phalcon/cphalcon · error · Phalcon\Support\Debug\Exceptions\RequestHalted

Halted request

Error message

Halted request

What it means

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.

Source

Thrown at phalcon/Support/Debug.zep:121

        return this->renderer;
    }

    /**
     * Generates a link to the current version documentation
     */
    public function getVersion() -> string
    {
        return this->renderer->getVersion();
    }

    /**
     * Halts the request showing a backtrace
     *
     * @throws RequestHalted
     */
    public function halt() -> void
    {
        throw new RequestHalted();
    }

    /**
     * Listen for uncaught exceptions and non silent notices or warnings
     */
    public function listen(
        bool exceptions = true,
        bool lowSeverity = false
    ) -> <static> {
        if exceptions {
            this->listenExceptions();
        }

        if lowSeverity {
            this->listenLowSeverity();
        }

        return this;

View on GitHub (pinned to b7419de9cd)

Solutions

  1. Remove the halt() call once tracing is done — it has no production purpose
  2. Guard it with an environment check so it can never fire outside development
  3. If one is left in code, catch RequestHalted in the global handler and convert it to a normal response

Example fix

// before
$debug->halt(); // fires in every environment

// after
if (($_ENV['APP_ENV'] ?? 'production') === 'development') {
    $debug->halt();
}
Defensive patterns

Strategy: validation

Validate before calling

$debug = new \Phalcon\Support\Debug();

if (($_ENV['APP_ENV'] ?? 'production') === 'development') {
    $debug->listen();
    $debug->halt(); // intentional breakpoint, dev only
}

Try / catch

use Phalcon\Support\Debug\Exceptions\RequestHalted;

try {
    $debug->halt();
} catch (RequestHalted $e) {
    $response
        ->setContent('Request halted for debugging')
        ->send();
}

Prevention

When it happens

Trigger: 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.

Common situations: Debug statements surviving into deployed code; intermittent halt() calls behind feature flags aborting requests for a subset of users.

Related errors


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/76231b411402d4d7. Report an issue: GitHub.