2016-09-05 17:50:48 2478次浏览 2条回答 1 悬赏 20 金钱

`

array(5) {

["errorHandler"]=>
object(yii\console\ErrorHandler)#6 (7) {
  ["discardExistingOutput"]=>
  bool(true)
  ["memoryReserveSize"]=>
  int(262144)
  ["exception"]=>
  NULL
  ["_memoryReserve":"yii\base\ErrorHandler":private]=>
  string(262144) "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

`
var_dump(Yii::$app);die; Yii::$app 进行打印 出现 26W个X 之前也遇到过,没关注,今天新安装的都出现了。。。。想过来问问。。

最佳答案

  • 天天无天天 发布于 2017-09-14 14:42 举报

    也发现了这个问题,追了源码:
    在ErrorHandler类里,有这个变量:
    /**

     * @var integer the size of the reserved memory. A portion of memory is pre-allocated so that
     * when an out-of-memory issue occurs, the error handler is able to handle the error with
     * the help of this reserved memory. If you set this value to be 0, no memory will be reserved.
     * Defaults to 256KB.
    

    */
    public $memoryReserveSize = 262144;

    /**
         * Register this error handler
         */
        public function register()
        {
            ini_set('display_errors', false);
            set_exception_handler([$this, 'handleException']);
            if (defined('HHVM_VERSION')) {
                set_error_handler([$this, 'handleHhvmError']);
            } else {
                set_error_handler([$this, 'handleError']);
            }
            if ($this->memoryReserveSize > 0) {
                $this->_memoryReserve = str_repeat('x', $this->memoryReserveSize);
            }
            register_shutdown_function([$this, 'handleFatalError']);
        }
    

    因为php没有用户主动分配内存的机制,所以,为了内存溢出也能抛出错误,预留了26w个x预先占用了内存。。。
    是不是很冷,哈哈

    , 觉得很赞
  • 回答于 2017-01-04 16:30 举报

    解决了吗?遇到同样问题。。

    2 条回复
    回复于 2017-01-04 17:41 回复

    没昵。最新版不知道有没有

    回复于 2017-01-04 18:25 回复

    一样有,console命令行模式下,web模式好像没有

您需要登录后才可以回答。登录 | 立即注册
最爱红烧肉
副总裁

最爱红烧肉

注册时间:2014-11-07
最后登录:2017-10-27
在线时长:69小时2分
  • 粉丝11
  • 金钱4740
  • 威望30
  • 积分5730

热门问题