组件报错组件不存在不知道什么原因

qq885896

问题描述

今天升级php版本时候没升级还好好的 升级了8.29后报文件不存在错误
框架源码也没动

Error: Class "Laravel\SerializableClosure\Support\ReflectionClosure" not found in F:\phpfile\webman2\vendor\illuminate\support\Onceable.php:67
Stack trace:
#0 F:\phpfile\webman2\vendor\illuminate\support\Onceable.php(35): Illuminate\Support\Onceable::hashFromTrace(Array, Object(Closure))
#1 F:\phpfile\webman2\vendor\illuminate\database\Eloquent\Concerns\PreventsCircularRecursion.php(29): Illuminate\Support\Onceable::tryFromTrace(Array, Object(Closure))
#2 F:\phpfile\webman2\vendor\illuminate\database\Eloquent\Model.php(1663): Illuminate\Database\Eloquent\Model->withoutRecursion(Object(Closure), Object(Closure))
#3 F:\phpfile\webman2\plugin\admin\app\functions.php(70): Illuminate\Database\Eloquent\Model->toArray()
#4 F:\phpfile\webman2\plugin\admin\app\functions.php(26): refresh_admin_session()
#5 F:\phpfile\webman2\plugin\admin\app\controller\IndexController.php(42): admin()
#6 F:\phpfile\webman2\vendor\workerman\webman-framework\src\App.php(322): plugin\admin\app\controller\IndexController->index(Object(support\Request))
#7 F:\phpfile\webman2\vendor\workerman\webman-framework\src\App.php(141): Webman\App::Webman\{closure}(Object(support\Request))
#8 F:\phpfile\webman2\vendor\workerman\workerman\Connection\TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))
#9 F:\phpfile\webman2\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #258)
#10 F:\phpfile\webman2\vendor\workerman\workerman\Worker.php(1488): Workerman\Events\Select->loop()
#11 F:\phpfile\webman2\vendor\workerman\workerman\Worker.php(1405): Workerman\Worker::forkWorkersForWindows()
#12 F:\phpfile\webman2\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
#13 F:\phpfile\webman2\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll()
#14 F:\phpfile\webman2\start.php(4): support\App::run()
#15 {main}

程序代码

    protected static function hashFromTrace(array $trace, callable $callable)
    {
        if (str_contains($trace[0]['file'] ?? '', 'eval()\'d code')) {
            return null;
        }

        $uses = array_map(
            fn (mixed $argument) => is_object($argument) ? spl_object_hash($argument) : $argument,
            $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureUsedVariables() : [],
        );

        return md5(sprintf(
            '%s@%s%s:%s (%s)',
            $trace[0]['file'],
            isset($trace[1]['class']) ? ($trace[1]['class'].'@') : '',
            $trace[1]['function'],
            $trace[0]['line'],
            serialize($uses),
        ));
    }
173 1 0
1个回答

walkor 打赏

laravel orm 官方新增了 laravel/serializable-closure 依赖,但是他们没在composer.json中定义,需要手动安装下

composer require -W laravel/serializable-closure
×
🔝