Cakephp 3.3.0-RC1:已发送标头

时间:2016-08-09 12:32:18

标签: cakephp cakephp-3.0

更新到cakephp 3.3.0-RC1之后,在我的日志中我有类似的内容:

2016-08-09 14:20:45 Warning: Headers already sent in /home/mirko/Server/mirkopagliai/vendor/cakephp/cakephp/src/Routing/Filter/AssetFilter.php:149

如何确定标题的重新发送位置?

1 个答案:

答案 0 :(得分:2)

  

如何确定标题的重新发送位置?

例如,通过使用适当的调试环境,您可以在Log::warning()中为Response::sendHeaders()调用设置断点,并检查控制流。

或者通过(暂时)攻击核心,并在日志中添加堆栈跟踪,您可以检查它以确定正在进行的操作。在vendor/cakephp/cakephp/src/Netork/Response.php中,将Log::warning()方法中的sendHeaders()调用修改为

$trace = \Cake\Error\Debugger::trace();
Log::warning("Headers already sent in {$file}:{$line}\nStack Trace:\n{$trace}\n");

<强> https://github.com/cakephp/cakephp/blob/3.3.0-RC1/src/Network/Response.php#L453