Skip to content

Commit 8bb4e57

Browse files
authored
add AddQueuedCookiesToResponse to middlewarePriority so it is handled in the right place (#46130)
* add AddQueuedCookiesToResponse to middlewarePriority so it is handled in the right place Hi there, i was trying to set `session storage` to `cookie`, but the cookies were not set at all. after a bit of search, this came up: #43693 and now i know what he meant. the queued cookies (https://github.com/laravel/framework/blob/10.x/src/Illuminate/Session/CookieSessionHandler.php#L101) never got sent back to the browser adding the middleware to the list so it is priority-sorted seems to resolve this issue (and fixes #43693) targets both 9.x and 10.x versions * update test
1 parent d252ed2 commit 8bb4e57

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Illuminate/Foundation/Http/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class Kernel implements KernelContract
102102
protected $middlewarePriority = [
103103
\Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
104104
\Illuminate\Cookie\Middleware\EncryptCookies::class,
105+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
105106
\Illuminate\Session\Middleware\StartSession::class,
106107
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
107108
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,

tests/Foundation/Http/KernelTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function testGetMiddlewarePriority()
3131
$this->assertEquals([
3232
\Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
3333
\Illuminate\Cookie\Middleware\EncryptCookies::class,
34+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
3435
\Illuminate\Session\Middleware\StartSession::class,
3536
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
3637
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,

0 commit comments

Comments
 (0)