[NFR]: Show the debug page in ADR apps

已关闭
#48 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@niden 已经在做这个了。

开始于 2026年11月3日。

评估

这个 Issue 还没有评估数据。

描述

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

主要语言
PHP
星标
6
派生
3
平均合并
3 小时 31 分钟
30 天内合并 PR
43

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

phalcon/debugbar 的其他 Issue

查看 phalcon/debugbar 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。