Skip to content

Commit ee35fdc

Browse files
Revert "[HttpKernel][Security] Fix accessing session for stateless request"
This reverts commit 40341a1.
1 parent 5d0fa8e commit ee35fdc

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
6666
$sessionMetadata = [];
6767
$sessionAttributes = [];
6868
$flashes = [];
69-
if (!$request->attributes->getBoolean('_stateless') && $request->hasSession()) {
69+
if ($request->hasSession()) {
7070
$session = $request->getSession();
7171
if ($session->isStarted()) {
7272
$sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated());

src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function onKernelResponse(ResponseEvent $event)
9797
return;
9898
}
9999

100-
$session = !$request->attributes->getBoolean('_stateless') && $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null;
100+
$session = $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null;
101101

102102
if ($session instanceof Session) {
103103
$usageIndexValue = $usageIndexReference = &$session->getUsageIndex();

src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public function testKernelTerminate()
4040
->willReturn($profile);
4141

4242
$kernel = $this->createMock(HttpKernelInterface::class);
43-
$mainRequest = new Request();
44-
$subRequest = new Request();
43+
$mainRequest = $this->createMock(Request::class);
44+
$subRequest = $this->createMock(Request::class);
4545
$response = $this->createMock(Response::class);
4646

4747
$requestStack = new RequestStack();

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function authenticate(RequestEvent $event)
9595
}
9696

9797
$request = $event->getRequest();
98-
$session = !$request->attributes->getBoolean('_stateless') && $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null;
98+
$session = $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null;
9999

100100
$request->attributes->set('_security_firewall_run', $this->sessionKey);
101101

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy