Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GH-7007: Synchronized Service alternative, backwards compatible. #7707

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

Closed
wants to merge 7 commits into from
Prev Previous commit
Next Next commit
[GH-7707] Fix bug with order of RequestFinished event + handling duri…
…ng exception.
  • Loading branch information
beberlei committed Apr 30, 2013
commit ec539ae599bd3890372b791c1592acb2219a0373
24 changes: 21 additions & 3 deletions 24 src/Symfony/Component/HttpKernel/HttpKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
$this->finishRequest($request, $type);

if (false === $catch) {
throw $e;
}
Expand Down Expand Up @@ -174,13 +176,29 @@ private function filterResponse(Response $response, Request $request, $type)

$this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);

$this->requestStack->pop();

$this->dispatcher->dispatch(KernelEvents::REQUEST_FINISHED, new RequestFinishedEvent($this, $request, $type));
$this->finishRequest($request, $type);

return $event->getResponse();
}

/**
* Publish event finished event, then pop the request from the stack.
*
* Note: Order of the operations is important here, otherwise operations
* such as {@link RequestStack::getParentRequest()} can lead to weird
* results.
*
* @param Request $request
* @param int $type
*
* @return void
*/
private function finishRequest(Request $request, $type)
{
$this->dispatcher->dispatch(KernelEvents::REQUEST_FINISHED, new RequestFinishedEvent($this, $request, $type));
$this->requestStack->pop();
}

/**
* Handles an exception by trying to convert it to a Response.
*
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/HttpKernel/RequestStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getMasterRequest()
/**
* Return the parent request of the current.
*
* If current Request ist the master request, method returns null.
* If current Request is the master request, method returns null.
*
* @return Request
*/
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.