public function ExceptionHandler::sendPhpResponse in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/ExceptionHandler.php \Symfony\Component\Debug\ExceptionHandler::sendPhpResponse()
Sends the error associated with the given Exception as a plain PHP response.
This method uses plain PHP functions like header() and echo to output the response.
Parameters
\Exception|FlattenException $exception An \Exception instance:
1 call to ExceptionHandler::sendPhpResponse()
- ExceptionHandler::failSafeHandle in vendor/symfony/ debug/ ExceptionHandler.php 
- Sends a response for the given Exception.
File
- vendor/symfony/ debug/ ExceptionHandler.php, line 182 
Class
- ExceptionHandler
- ExceptionHandler converts an exception to a Response object.
Namespace
Symfony\Component\DebugCode
public function sendPhpResponse($exception) {
  if (!$exception instanceof FlattenException) {
    $exception = FlattenException::create($exception);
  }
  if (!headers_sent()) {
    header(sprintf('HTTP/1.0 %s', $exception
      ->getStatusCode()));
    foreach ($exception
      ->getHeaders() as $name => $value) {
      header($name . ': ' . $value, false);
    }
    header('Content-Type: text/html; charset=' . $this->charset);
  }
  echo $this
    ->decorate($this
    ->getContent($exception), $this
    ->getStylesheet($exception));
}