vendor/symfony/symfony/src/Symfony/Component/Debug/Exception/FatalErrorException.php line 14

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Debug\Exception;
  11. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.'FatalErrorException::class, \Symfony\Component\ErrorHandler\Error\FatalError::class), \E_USER_DEPRECATED);
  12. /**
  13.  * Fatal Error Exception.
  14.  *
  15.  * @author Konstanton Myakshin <koc-dp@yandex.ru>
  16.  *
  17.  * @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Error\FatalError instead.
  18.  */
  19. class FatalErrorException extends \ErrorException
  20. {
  21.     public function __construct(string $messageint $codeint $severitystring $filenameint $linenoint $traceOffset nullbool $traceArgs true, array $trace null, \Throwable $previous null)
  22.     {
  23.         parent::__construct($message$code$severity$filename$lineno$previous);
  24.         if (null !== $trace) {
  25.             if (!$traceArgs) {
  26.                 foreach ($trace as &$frame) {
  27.                     unset($frame['args'], $frame['this'], $frame);
  28.                 }
  29.             }
  30.             $this->setTrace($trace);
  31.         } elseif (null !== $traceOffset) {
  32.             if (\function_exists('xdebug_get_function_stack') && $trace = @xdebug_get_function_stack()) {
  33.                 if ($traceOffset) {
  34.                     array_splice($trace, -$traceOffset);
  35.                 }
  36.                 foreach ($trace as &$frame) {
  37.                     if (!isset($frame['type'])) {
  38.                         // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
  39.                         if (isset($frame['class'])) {
  40.                             $frame['type'] = '::';
  41.                         }
  42.                     } elseif ('dynamic' === $frame['type']) {
  43.                         $frame['type'] = '->';
  44.                     } elseif ('static' === $frame['type']) {
  45.                         $frame['type'] = '::';
  46.                     }
  47.                     // XDebug also has a different name for the parameters array
  48.                     if (!$traceArgs) {
  49.                         unset($frame['params'], $frame['args']);
  50.                     } elseif (isset($frame['params']) && !isset($frame['args'])) {
  51.                         $frame['args'] = $frame['params'];
  52.                         unset($frame['params']);
  53.                     }
  54.                 }
  55.                 unset($frame);
  56.                 $trace array_reverse($trace);
  57.             } else {
  58.                 $trace = [];
  59.             }
  60.             $this->setTrace($trace);
  61.         }
  62.     }
  63.     protected function setTrace($trace)
  64.     {
  65.         $traceReflector = new \ReflectionProperty(\Exception::class, 'trace');
  66.         $traceReflector->setAccessible(true);
  67.         $traceReflector->setValue($this$trace);
  68.     }
  69. }