Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/http-kernel/HttpKernel.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/http-kernel/HttpKernel.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/http-kernel/HttpKernel.php Mon Apr 23 09:46:53 2018 +0100 @@ -25,7 +25,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; +use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -67,8 +67,8 @@ try { return $this->handleRaw($request, $type); } catch (\Exception $e) { - if ($e instanceof ConflictingHeadersException) { - $e = new BadRequestHttpException('The request headers contain conflicting information regarding the origin of this request.', $e); + if ($e instanceof RequestExceptionInterface) { + $e = new BadRequestHttpException($e->getMessage(), $e); } if (false === $catch) { $this->finishRequest($request, $type); @@ -89,14 +89,12 @@ } /** - * @throws \LogicException If the request stack is empty - * * @internal */ - public function terminateWithException(\Exception $exception) + public function terminateWithException(\Exception $exception, Request $request = null) { - if (!$request = $this->requestStack->getMasterRequest()) { - throw new \LogicException('Request stack is empty', 0, $exception); + if (!$request = $request ?: $this->requestStack->getMasterRequest()) { + throw $exception; } $response = $this->handleException($exception, $request, self::MASTER_REQUEST); @@ -150,7 +148,7 @@ $arguments = $event->getArguments(); // call controller - $response = call_user_func_array($controller, $arguments); + $response = \call_user_func_array($controller, $arguments); // view if (!$response instanceof Response) { @@ -242,10 +240,12 @@ // the developer asked for a specific status code if ($response->headers->has('X-Status-Code')) { + @trigger_error(sprintf('Using the X-Status-Code header is deprecated since Symfony 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), E_USER_DEPRECATED); + $response->setStatusCode($response->headers->get('X-Status-Code')); $response->headers->remove('X-Status-Code'); - } elseif (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { + } elseif (!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { // ensure that we actually have an error response if ($e instanceof HttpExceptionInterface) { // keep the HTTP status code and headers