Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes: 在控制器中动态更改debug,还是注入了trace #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

xuanyanwow
Copy link

场景描述:在有的接口,无论是否为调试模式,都想强行不注入trace。比如根据文章id 生成js脚本,用于前端<script>标签引入。如果注入了trace,将会产生报错。

有问题的使用方式:

App::debug(false);
return "test";

原因:在源码中,trace中间件 执行$next(),之后,判断debug是用变量,没有重新判断

@gitlilimin
Copy link

我也发现了这个问题,希望能采用这个PR。

说一个该问题比较常用的场景,在对接微信公众平台服务端消息通知时,首次接入需要返回一个纯字符串的验证,就是因为这个trace导致一直验证失败,排查问题花了不少时间,因为确实不太容易考虑到这点。

由于trace是由Service注册的前置中间件,导致控制器层无法控制是否启用它,我认为本PR是合理的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants