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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Illuminate/Session/Middleware/StartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Illuminate\Contracts\Session\Session;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Session\SessionManager;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
Expand Down Expand Up @@ -56,7 +57,7 @@ public function handle($request, Closure $next)
$session = $this->getSession($request);

if ($this->manager->shouldBlock() ||
($request->route() && $request->route()->locksFor())) {
($request->route() instanceof Route && $request->route()->locksFor())) {
return $this->handleRequestWhileBlocking($request, $session, $next);
} else {
return $this->handleStatefulRequest($request, $session, $next);
Expand All @@ -73,6 +74,10 @@ public function handle($request, Closure $next)
*/
protected function handleRequestWhileBlocking(Request $request, $session, Closure $next)
{
if (! $request->route() instanceof Route) {
return;
}

$lockFor = $request->route() && $request->route()->locksFor()
? $request->route()->locksFor()
: 10;
Expand Down Expand Up @@ -195,7 +200,7 @@ protected function configHitsLottery(array $config)
protected function storeCurrentUrl(Request $request, $session)
{
if ($request->method() === 'GET' &&
$request->route() &&
$request->route() instanceof Route &&
! $request->ajax() &&
! $request->prefetch()) {
$session->setPreviousUrl($request->fullUrl());
Expand Down