[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/vendor/symfony/debug/Exception/ -> FatalErrorException.php (source)

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


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1