123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- /*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Symfony\Component\HttpKernel\Exception;
- /**
- * Fatal Error Exception.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Konstanton Myakshin <koc-dp@yandex.ru>
- * @author Nicolas Grekas <p@tchwork.com>
- *
- * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
- */
- class FatalErrorException extends \ErrorException
- {
- }
- namespace Symfony\Component\Debug\Exception;
- use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
- /**
- * Fatal Error Exception.
- *
- * @author Konstanton Myakshin <koc-dp@yandex.ru>
- */
- class FatalErrorException extends LegacyFatalErrorException
- {
- 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);
- }
- }
- protected function setTrace($trace)
- {
- $traceReflector = new \ReflectionProperty('Exception', 'trace');
- $traceReflector->setAccessible(true);
- $traceReflector->setValue($this, $trace);
- }
- }
|