8000 Fix Request stack state if throwable is thrown · symfony/symfony@f55c39d · GitHub
[go: up one dir, main page]

Skip to content

Commit f55c39d

Browse files
committed
Fix Request stack state if throwable is thrown
1 parent ade30f7 commit f55c39d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/HttpKernel/HttpKernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
7676
{
7777
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
7878

79+
$this->requestStack->push($request);
7980
try {
8081
return $this->handleRaw($request, $type);
8182
} catch (\Exception $e) {
@@ -89,6 +90,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
8990
}
9091

9192
return $this->handleThrowable($e, $request, $type);
93+
} finally {
94+
$this->requestStack->pop();
9295
}
9396
}
9497

@@ -127,8 +130,6 @@ public function terminateWithException(\Throwable $exception, Request $request =
127130
*/
128131
private function handleRaw(Request $request, int $type = self::MASTER_REQUEST): Response
129132
{
130-
$this->requestStack->push($request);
131-
132133
// request
133134
$event = new RequestEvent($this, $request, $type);
134135
$this->dispatcher->dispatch($event, KernelEvents::REQUEST);
@@ -205,7 +206,6 @@ private function filterResponse(Response $response, Request $request, int $type)
205206
private function finishRequest(Request $request, int $type)
206207
{
207208
$this->dispatcher->dispatch(new FinishRequestEvent($this, $request, $type), KernelEvents::FINISH_REQUEST);
208-
$this->requestStack->pop();
209209
}
210210

211211
/**

0 commit comments

Comments
 (0)
0