Laravel 9 自定义 FormRequest 抛出 "Object of type Illuminate\Session\Store is not callable"
Laravel 9 custom FormRequest throws "Object of type Illuminate\Session\Store is not callable"
我正在测试新的 laravel 9,我很遗憾地遇到了这个惊喜。
在使用 PHP artisan make:request UpdateUserRequest
并将其设置为我对传入更新功能的请求 class 后,出现此错误:
[2022-02-09 12:42:08] local.ERROR: Object of type Illuminate\Session\Store is not callable {"userId":2,"exception":"[object] (Error(code: 0): Object of type Illuminate\Session\Store is not callable at /app/vendor/symfony/http-foundation/Request.php:698)
我的代码
用户控制器:
public function update(UpdateUserRequest $request){}
更新用户请求:
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
到目前为止,我为解决问题所做的工作是查看问题何时发生。
当我将我的 UpdateUserRequest 的扩展 class 从 FormRequest 更改为 Request 时,错误不会发生。
所以它似乎在 FormRequest.
在我的路由中添加'web'中间件也没有解决问题(来自互联网的建议)
我当然可以创建自己的 class,它不扩展任何内容,只是使用常规请求 class 验证它,但这当然不是它应该如何工作的。
完整的堆栈跟踪:
Error:
Object of type Illuminate\Session\Store is not callable
at /app/vendor/symfony/http-foundation/Request.php:698
at Symfony\Component\HttpFoundation\Request->getSession()
(/app/vendor/laravel/framework/src/Illuminate/Http/Request.php:424)
at Illuminate\Http\Request::createFrom(object(Request), object(UpdateUserRequest))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php:34)
at Illuminate\Foundation\Providers\FormRequestServiceProvider->Illuminate\Foundation\Providers\{closure}(object(UpdateUserRequest), object(Application))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1269)
at Illuminate\Container\Container->fireCallbackArray(object(UpdateUserRequest), array(object(Closure)))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1216)
at Illuminate\Container\Container->fireResolvingCallbacks('App\Http\Requests\UpdateUserRequest', object(UpdateUserRequest))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:778)
at Illuminate\Container\Container->resolve('App\Http\Requests\UpdateUserRequest', array(), true)
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:854)
at Illuminate\Foundation\Application->resolve('App\Http\Requests\UpdateUserRequest', array())
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:694)
at Illuminate\Container\Container->make('App\Http\Requests\UpdateUserRequest', array())
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:839)
at Illuminate\Foundation\Application->make('App\Http\Requests\UpdateUserRequest')
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:79)
at Illuminate\Routing\ControllerDispatcher->transformDependency(object(ReflectionParameter), array('user' => '10'), object(stdClass))
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:48)
at Illuminate\Routing\ControllerDispatcher->resolveMethodDependencies(array('user' => '10'), object(ReflectionMethod))
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:28)
at Illuminate\Routing\ControllerDispatcher->resolveClassMethodDependencies(array('user' => '10'), object(UserController), 'update')
(/app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:41)
at Illuminate\Routing\ControllerDispatcher->dispatch(object(Route), object(UserController), 'update')
(/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:261)
at Illuminate\Routing\Route->runController()
(/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:204)
at Illuminate\Routing\Route->run()
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:695)
at Illuminate\Routing\Router->Illuminate\Routing\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/spatie/laravel-permission/src/Middlewares/RoleMiddleware.php:27)
at Spatie\Permission\Middlewares\RoleMiddleware->handle(object(Request), object(Closure), 'superadmin')
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:50)
at Illuminate\Routing\Middleware\SubstituteBindings->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:44)
at Illuminate\Auth\Middleware\Authenticate->handle(object(Request), object(Closure), 'web')
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:44)
at Illuminate\Auth\Middleware\Authenticate->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:78)
at Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49)
at Illuminate\View\Middleware\ShareErrorsFromSession->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:121)
at Illuminate\Session\Middleware\StartSession->handleStatefulRequest(object(Request), object(Store), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:64)
at Illuminate\Session\Middleware\StartSession->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37)
at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:67)
at Illuminate\Cookie\Middleware\EncryptCookies->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:697)
at Illuminate\Routing\Router->runRouteWithinStack(object(Route), object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:672)
at Illuminate\Routing\Router->runRoute(object(Request), object(Route))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:636)
at Illuminate\Routing\Router->dispatchToRoute(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:625)
at Illuminate\Routing\Router->dispatch(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:167)
at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)
at Illuminate\Foundation\Http\Middleware\TrimStrings->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:86)
at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/fruitcake/laravel-cors/src/HandleCors.php:38)
at Fruitcake\Cors\HandleCors->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)
at Illuminate\Http\Middleware\TrustProxies->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:142)
at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:111)
at Illuminate\Foundation\Http\Kernel->handle(object(Request))
(/app/public/index.php:52)
这确实不是 laravel 9 问题。
此问题是从升级 laravel-dev 到正式版本。
由于没有编写那么多代码,我决定克隆新的 laravel 9 存储库,并手动将我的更改推送到这个新存储库。然后一切正常。
我正在测试新的 laravel 9,我很遗憾地遇到了这个惊喜。
在使用 PHP artisan make:request UpdateUserRequest
并将其设置为我对传入更新功能的请求 class 后,出现此错误:
[2022-02-09 12:42:08] local.ERROR: Object of type Illuminate\Session\Store is not callable {"userId":2,"exception":"[object] (Error(code: 0): Object of type Illuminate\Session\Store is not callable at /app/vendor/symfony/http-foundation/Request.php:698)
我的代码
用户控制器:
public function update(UpdateUserRequest $request){}
更新用户请求:
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
到目前为止,我为解决问题所做的工作是查看问题何时发生。 当我将我的 UpdateUserRequest 的扩展 class 从 FormRequest 更改为 Request 时,错误不会发生。 所以它似乎在 FormRequest.
在我的路由中添加'web'中间件也没有解决问题(来自互联网的建议)
我当然可以创建自己的 class,它不扩展任何内容,只是使用常规请求 class 验证它,但这当然不是它应该如何工作的。
完整的堆栈跟踪:
Error:
Object of type Illuminate\Session\Store is not callable
at /app/vendor/symfony/http-foundation/Request.php:698
at Symfony\Component\HttpFoundation\Request->getSession()
(/app/vendor/laravel/framework/src/Illuminate/Http/Request.php:424)
at Illuminate\Http\Request::createFrom(object(Request), object(UpdateUserRequest))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php:34)
at Illuminate\Foundation\Providers\FormRequestServiceProvider->Illuminate\Foundation\Providers\{closure}(object(UpdateUserRequest), object(Application))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1269)
at Illuminate\Container\Container->fireCallbackArray(object(UpdateUserRequest), array(object(Closure)))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:1216)
at Illuminate\Container\Container->fireResolvingCallbacks('App\Http\Requests\UpdateUserRequest', object(UpdateUserRequest))
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:778)
at Illuminate\Container\Container->resolve('App\Http\Requests\UpdateUserRequest', array(), true)
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:854)
at Illuminate\Foundation\Application->resolve('App\Http\Requests\UpdateUserRequest', array())
(/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:694)
at Illuminate\Container\Container->make('App\Http\Requests\UpdateUserRequest', array())
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:839)
at Illuminate\Foundation\Application->make('App\Http\Requests\UpdateUserRequest')
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:79)
at Illuminate\Routing\ControllerDispatcher->transformDependency(object(ReflectionParameter), array('user' => '10'), object(stdClass))
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:48)
at Illuminate\Routing\ControllerDispatcher->resolveMethodDependencies(array('user' => '10'), object(ReflectionMethod))
(/app/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php:28)
at Illuminate\Routing\ControllerDispatcher->resolveClassMethodDependencies(array('user' => '10'), object(UserController), 'update')
(/app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:41)
at Illuminate\Routing\ControllerDispatcher->dispatch(object(Route), object(UserController), 'update')
(/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:261)
at Illuminate\Routing\Route->runController()
(/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:204)
at Illuminate\Routing\Route->run()
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:695)
at Illuminate\Routing\Router->Illuminate\Routing\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/spatie/laravel-permission/src/Middlewares/RoleMiddleware.php:27)
at Spatie\Permission\Middlewares\RoleMiddleware->handle(object(Request), object(Closure), 'superadmin')
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:50)
at Illuminate\Routing\Middleware\SubstituteBindings->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:44)
at Illuminate\Auth\Middleware\Authenticate->handle(object(Request), object(Closure), 'web')
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:44)
at Illuminate\Auth\Middleware\Authenticate->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:78)
at Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49)
at Illuminate\View\Middleware\ShareErrorsFromSession->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:121)
at Illuminate\Session\Middleware\StartSession->handleStatefulRequest(object(Request), object(Store), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:64)
at Illuminate\Session\Middleware\StartSession->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37)
at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:67)
at Illuminate\Cookie\Middleware\EncryptCookies->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:697)
at Illuminate\Routing\Router->runRouteWithinStack(object(Route), object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:672)
at Illuminate\Routing\Router->runRoute(object(Request), object(Route))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:636)
at Illuminate\Routing\Router->dispatchToRoute(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:625)
at Illuminate\Routing\Router->dispatch(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:167)
at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)
at Illuminate\Foundation\Http\Middleware\TrimStrings->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:86)
at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/fruitcake/laravel-cors/src/HandleCors.php:38)
at Fruitcake\Cors\HandleCors->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)
at Illuminate\Http\Middleware\TrustProxies->handle(object(Request), object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:142)
at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
(/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:111)
at Illuminate\Foundation\Http\Kernel->handle(object(Request))
(/app/public/index.php:52)
这确实不是 laravel 9 问题。 此问题是从升级 laravel-dev 到正式版本。
由于没有编写那么多代码,我决定克隆新的 laravel 9 存储库,并手动将我的更改推送到这个新存储库。然后一切正常。