Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Fix incompatibility with Lumen route function which return an array. #34491

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

nabihnadhif
Copy link

When we use illuminate/session within a lumen project. StartSession middleware fails with the following error:

[2020-09-23 11:43:38] production.ERROR: Call to a member function locksFor() on array {"exception":"[object] (Error(code: 0): Call to a member function locksFor() on array at /var/www/html/vendor/illuminate/session/Middleware/StartSession.php:59)
[stacktrace]
#0 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#1 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#2 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#3 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(103): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#4 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(423): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#5 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(260): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#6 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(234): Laravel\\Lumen\\Application->handleFoundRoute(Array)
#7 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(170): Laravel\\Lumen\\Application->handleDispatcherResponse(Array)
#8 [internal function]: Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#9 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(48): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#10 /var/www/html/vendor/total-services/core/src/Http/Middleware/LocaleMiddleware.php(33): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#11 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\LocaleMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#12 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#13 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#14 /var/www/html/vendor/total-services/core/src/Http/Middleware/XForwardedPathMiddleware.php(30): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#15 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\XForwardedPathMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#16 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#17 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#18 /var/www/html/vendor/fideloper/proxy/src/TrustProxies.php(57): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#19 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#20 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#21 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#22 /var/www/html/vendor/total-services/core/src/Http/Middleware/ConvertStringBooleansMiddleware.php(25): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#23 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\ConvertStringBooleansMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#24 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#25 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#26 /var/www/html/vendor/total-services/core/src/Http/Middleware/ConvertEmptyStringsToNull.php(15): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#27 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#28 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#29 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#30 /var/www/html/vendor/total-services/core/src/Http/Middleware/MaintenanceModeMiddleware.php(30): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#31 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\MaintenanceModeMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#32 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#33 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#34 /var/www/html/vendor/total-services/core/src/Http/Middleware/CountryBlockerMiddleware.php(40): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#35 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): TotalServices\\Core\\Http\\Middleware\\CountryBlockerMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#36 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#37 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#38 /var/www/html/app/Http/Middleware/Cors.php(29): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#39 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(167): App\\Http\\Middleware\\Cors->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#40 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#41 /var/www/html/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): call_user_func(Object(Closure), Object(Laravel\\Lumen\\Http\\Request))
#42 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(103): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#43 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(423): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#44 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(172): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#45 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(109): Laravel\\Lumen\\Application->dispatch(NULL)
#46 /var/www/html/public/index.php(17): Laravel\\Lumen\\Application->run()
#47 {main}
"} 

The reason is that Laravel\Lumen\Http\Request::route() return array|null when Illuminate\Http\Request::route() return Illuminate\Routing\Route|object|null.

Lumen $request->route() signature is different from Illuminate\Http\Request::route
@taylorotwell taylorotwell merged commit 689b172 into laravel:8.x Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants