gpt4 book ai didi

laravel - Laravel 5.4 和 PHP 7 的 Composer 更新 "Class Name must be a valid object or a string"

转载 作者:行者123 更新时间:2023-12-03 02:26:03 24 4
gpt4 key购买 nike

所以有一些关于此的线程,但没有一个具有完全相同的问题。基本上我从 5.1 升级到 php 5.4,从 5.6 升级到 php 7,现在收到此错误消息。

PHP Fatal error:  Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96

这对我来说很奇怪的原因是错误出现在实际的 laravel 文件中,而不是在我的应用程序/我编辑过的内容中。当我运行 Composer update 或每当我尝试访问我的任何网页时,都会发生此错误。以下是 Composer 更新的完整转储,有什么想法吗?

[root@dev1 dev1]# composer update
> php artisan clear-compiled
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'Symfony\\Compone...')
#1 /var/www/dev1/bootstrap/cache/compiled.php(6207): call_user_func(Object(Closure), 0, 'Symfony\\Compone...')
#2 /var/www/dev1/bootstrap/cache/compiled.php(12223): Illuminate\Support\Arr::first(Array, Object(Closure), NULL)
#3 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(97): Illuminate\Support\Collection->first(Object(Closure))
#4 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(ReflectionException))
#5 /var/www/dev1/app/Exceptions/Handler.php(33): Illuminate\Foundation\Exceptions\Handler->report(Object(ReflectionException))
#6 /var/www/dev1/vendor/laravel/fram in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 96
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255

最佳答案

升级到 Laravel 5.4 时我遇到了类似的错误。问题是 Laravel 仍在加载 bootstrap/cache/compiled.php (尽管它说框架不再使用它)。删除该文件将解决您的问题。

From the docs :

If it exists, you may delete the bootstrap/cache/compiled.php file. It is no longer used by the framework.

关于laravel - Laravel 5.4 和 PHP 7 的 Composer 更新 "Class Name must be a valid object or a string",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42727726/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com