如何修复laravel-dump-server中的null给定错误?

时间:2018-10-18 04:27:34

标签: laravel-5 dump

我添加了“ beyondcode / laravel-dump-server”:“ ^ 1.2” 到我的Laravel 5.7应用程序,有时会出错

[2018-10-18 03:44:02] local.ERROR: Argument 1 passed to Symfony\Component\VarDumper\Dumper\HtmlDumper::dump() must be an instance of Symfony\Component\VarDumper\Cloner\Data, null given, called in /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php on line 47 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper::dump() must be an instance of Symfony\\Component\\VarDumper\\Cloner\\Data, null given, called in /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php on line 47 at /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/symfony/var-dumper/Dumper/HtmlDumper.php:111)
[stacktrace]

我在控制台中以以下方式运行服务器:

php artisan dump-server --format=html > public/dump.html

我将包装器方法添加到我的应用程序的通用特征中:

<?php

namespace App\Http\Traits;

use File;
use Barryvdh\Debugbar\Facade as Debugbar;
use Carbon\Carbon;
use Config;
use Intervention\Image\Facades\Image as Image;
trait funcsTrait
{
    public function d($data)
    {

        if (empty($data)) {
            return;
        }

        dump($data);
    }

并在我的控件中调用此方法:

 $this->d('ProfilePageTest Test51:: $newUserSessionData::' . print_r($newUserSessionData, true));

有时我会遇到上述错误。 在我的包装器中,我尝试排除使用空值进行转储的调用,假设空值可能是导致此错误的原因? 但是看起来原因是不同的。如果有办法可以使其正常工作?

谢谢!

0 个答案:

没有答案