You are here

public function FatalErrorException::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/debug/Exception/FatalErrorException.php \Symfony\Component\HttpKernel\Exception\FatalErrorException::__construct()

File

vendor/symfony/debug/Exception/FatalErrorException.php, line 38

Class

FatalErrorException
Fatal Error Exception.

Namespace

Symfony\Component\HttpKernel\Exception

Code

public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null) {
  parent::__construct($message, $code, $severity, $filename, $lineno);
  if (null !== $trace) {
    if (!$traceArgs) {
      foreach ($trace as &$frame) {
        unset($frame['args'], $frame['this'], $frame);
      }
    }
    $this
      ->setTrace($trace);
  }
  elseif (null !== $traceOffset) {
    if (function_exists('xdebug_get_function_stack')) {
      $trace = xdebug_get_function_stack();
      if (0 < $traceOffset) {
        array_splice($trace, -$traceOffset);
      }
      foreach ($trace as &$frame) {
        if (!isset($frame['type'])) {

          // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
          if (isset($frame['class'])) {
            $frame['type'] = '::';
          }
        }
        elseif ('dynamic' === $frame['type']) {
          $frame['type'] = '->';
        }
        elseif ('static' === $frame['type']) {
          $frame['type'] = '::';
        }

        // XDebug also has a different name for the parameters array
        if (!$traceArgs) {
          unset($frame['params'], $frame['args']);
        }
        elseif (isset($frame['params']) && !isset($frame['args'])) {
          $frame['args'] = $frame['params'];
          unset($frame['params']);
        }
      }
      unset($frame);
      $trace = array_reverse($trace);
    }
    elseif (function_exists('symfony_debug_backtrace')) {
      $trace = symfony_debug_backtrace();
      if (0 < $traceOffset) {
        array_splice($trace, 0, $traceOffset);
      }
    }
    else {
      $trace = array();
    }
    $this
      ->setTrace($trace);
  }
}