gpt4 book ai didi

php - 创建新的中间件时,Laravel抛出: “Maximum function nesting level of ' 10 0' reached, aborting!”

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

我重新安装了Laravel 5.2(osx:10.11,php:5.6)。当我创建一个新的中间件(LocaleMiddleware.php)时,Laravel崩溃并显示以下信息:

Maximum function nesting level of '100' reached, aborting!



最让我担心的是,即使新的中间件的功能主体为空/注释,我的应用程序也会崩溃!

kernel.php
...

/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\LocaleMiddleware::class, //<-- My Middleware
],

'api' => [
'throttle:60,1',
],
];

LocaleMiddleware.php,即使函数主体被注释掉,它也会使我的应用程序崩溃:
<?php

namespace App\Http\Middleware;
use Illuminate\Support\Facades\Session;
use Closure;

class LocaleMiddleware
{
/**
* Run the request filter.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) {

// $language = Session::get('language');
// //print_r(Session::all());
// \App::setLocale($language, config('app.locale'));

return $next($request);
}

}

错误:
in Autoloader.php line 72
at FatalErrorException->__construct() in HandleExceptions.php line 133
at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
at PHPExcel_Autoloader::Load() in ClassLoader.php line 0
at spl_autoload_call() in ClassLoader.php line 29
in ClassLoader.php line 412
at Composer\Autoload\includeFile() in ClassLoader.php line 301
at ClassLoader->loadClass() in Parser.php line 0
at spl_autoload_call() in Parser.php line 45
at Tokenizer->__construct() in Parser.php line 42
at Parser->__construct() in Translator.php line 78
at Translator->__construct() in CssSelectorConverter.php line 36
at CssSelectorConverter->__construct() in CssToInlineStyles.php line 20
at CssToInlineStyles->__construct() in ExcelServiceProvider.php line 111
at ExcelServiceProvider->Maatwebsite\Excel\{closure}() in Container.php line 731
at Container->build() in Container.php line 629
at Container->make() in Application.php line 697
at Application->make() in Container.php line 1178
at Container->offsetGet() in Container.php line 136
at ExcelServiceProvider->Maatwebsite\Excel\{closure}() in Container.php line 731
at Container->build() in Container.php line 629
at Container->make() in Application.php line 697
at Application->make() in Container.php line 1178
at Container->offsetGet() in Container.php line 151
at ExcelServiceProvider->Maatwebsite\Excel\{closure}() in Container.php line 731
at Container->build() in Container.php line 629
at Container->make() in Application.php line 697
at Application->make() in Container.php line 1178
at Container->offsetGet() in Container.php line 186
at ExcelServiceProvider->Maatwebsite\Excel\{closure}() in Container.php line 731
at Container->build() in Container.php line 629
at Container->make() in Application.php line 697
at Application->make() in Container.php line 1178
at Container->offsetGet() in Facade.php line 151
at Facade::resolveFacadeInstance() in Facade.php line 120
at Facade::getFacadeRoot() in Facade.php line 207
at Facade::__callStatic() in SubcategoryController.php line 19
at Excel::load() in SubcategoryController.php line 19
at SubcategoryController->start() in Controller.php line 80
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:80}() in Controller.php line 80
at Controller->callAction() in ControllerDispatcher.php line 146
at ControllerDispatcher->call() in ControllerDispatcher.php line 94
at ControllerDispatcher->Illuminate\Routing\{closure}() in Pipeline.php line 52
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack() in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch() in Route.php line 174
at Route->runController() in Route.php line 140
at Route->run() in Router.php line 724
at Router->Illuminate\Routing\{closure}() in Pipeline.php line 52
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in LocaleMiddleware.php line 22
at LocaleMiddleware->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in StartSession.php line 64
at StartSession->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in EncryptCookies.php line 59
at EncryptCookies->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Router.php line 726
at Router->runRouteWithinStack() in Router.php line 699
at Router->dispatchToRoute() in Router.php line 675
at Router->dispatch() in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}() in Pipeline.php line 52
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle() in Pipeline.php line 136
at call_user_func_array:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{/Websites/Heuss/lheuss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Kernel.php line 132
at Kernel->sendRequestThroughRouter() in Kernel.php line 99
at Kernel->handle() in index.php line 54
at {main}() in index.php line 0

最佳答案

问题不在中间件中-查看堆栈,您的应用程序经过中间件并输入SubcategoryController。看起来ExcelServiceProvider的闭包中正在发生某些事情,因此请进行检查。

关于php - 创建新的中间件时,Laravel抛出: “Maximum function nesting level of ' 10 0' reached, aborting!”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42469646/

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