[NFR]: Show the debug page in ADR apps

Fermée
#48 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@niden y travaille déjà.

Depuis le 3/11/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

enhancement
Summary

The package gives two things: the debug bar and the debug page (Phalcon\Debug). The debug page does not show in an ADR app, because ADR catches all exceptions before the debug page handler can run. Show the debug page in ADR apps, in development only.

Current state
  • Debug::listen() uses set_exception_handler() (src/Debug.php:178).
  • Phalcon\ADR\Application::handle() catches each Throwable and sends it to ErrorResponder. AbstractHttpFront::run() also catches each Throwable. The handler does not run for these exceptions.
  • Debug::halt() throws RequestHalted (src/Debug.php:147), and onUncaughtLowSeverity() throws RuntimeWarning (src/Debug.php:253). In an Action, these also go to ErrorResponder, so the client gets a generic error response.
  • ErrorResponder has a debug mode that gives the exception to the client. It does not give the debug page (backtrace, code fragments and superglobals).
Proposed direction
  • Use the logger adapter from #47 to get the exception.
  • Add a listener on application:afterHandle. When the logger received an exception, the response status is 500 or higher and the response is not JSON, the listener replaces the response content with Debug::renderHtml($exception).
  • Keep the status that ErrorResponder set. A 404 from RouteNotFound keeps the application error page.
  • The application opts in through a config key of the ADR service provider from #14.
  • The listener runs only when the bar boots, and only for a client that AccessGate allows. The debug page shows sensitive data.
Notes

This design is not tested yet. Test it first in this issue.

Acceptance
  • In an ADR app in development, an exception in an Action shows the debug page.
  • Debug::halt() in an Action shows the debug page.
  • The debug page is absent in a blocked environment and for a denied client.
  • The debug page does not replace a JSON response or a 404 response.
  • The bar is not injected into the debug page.
  • The public API of Phalcon\Debug does not change.
  • Tests pass with full coverage. phpcs and phpstan pass.
Depends on
  • #14
  • #47
Part of

#13

Langage dominant
PHP
Étoiles
6
Forks
3
Merge moyen
5 h 50 min
PR mergées (30 j)
18

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Issues similaires

Plus d'issues PHP

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.