0

我使用 composer update 更新到最新版本的 Laravel 4。现在我遇到了它使用的错误处理库的问题 - 哎呀。当我的代码中有错误时,例如语法错误会发生以下情况:

  1. 我重新加载页面
  2. 实际异常('Unexpected xxxx at ...')出现不到一秒
  3. 另一个例外取代了它:

    Cannot modify header information - headers already sent by (output started at /Users/planewalker/Sites/jean/welper/vendor/filp/whoops/src/Whoops/Run.php:204)
    

上一行的代码是这样的:

        // If we're allowed to, send output generated by handlers directly
        // to the output, otherwise, return it so that it may be used by
        // the caller.
        if($this->writeToOutput()) {
            echo $output;
        }

        return $output;

更具体地说是echo $output;部分。

有谁知道为什么会这样?

更新:

我现在已经确定问题是由 set_cookie 函数结合 Whoops 库的异常输出引起的。似乎在 Whoops 库开始输出其视图之后调用了 set_cookie 函数。

我发现的唯一解决方案是使用与“cookie”不同的会话驱动程序。我已切换到使用“本机”,问题不再出现。

4

2 回答 2

0

Try updating your Laravel 4:

composer update

This problem should be fixed and you would receive the first exception which is thrown.

于 2013-05-09T10:27:55.493 回答
0

Have you edited the start.php or path.php for echoing debug informations. In the most cases this is the problem. Because start.php is called before the errorhandler is called and in Laravel for every output headers are sent.

于 2013-05-07T21:28:25.583 回答