4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Exception;
15 * Fatal Error Exception.
17 * @author Fabien Potencier <fabien@symfony.com>
18 * @author Konstanton Myakshin <koc-dp@yandex.ru>
19 * @author Nicolas Grekas <p@tchwork.com>
21 * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
23 class FatalErrorException extends \ErrorException
27 namespace Symfony\Component\Debug\Exception;
29 use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
32 * Fatal Error Exception.
34 * @author Konstanton Myakshin <koc-dp@yandex.ru>
36 class FatalErrorException extends LegacyFatalErrorException
38 public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
40 parent::__construct($message, $code, $severity, $filename, $lineno);
42 if (null !== $trace) {
44 foreach ($trace as &$frame) {
45 unset($frame['args'], $frame['this'], $frame);
49 $this->setTrace($trace);
50 } elseif (null !== $traceOffset) {
51 if (function_exists('xdebug_get_function_stack')) {
52 $trace = xdebug_get_function_stack();
53 if (0 < $traceOffset) {
54 array_splice($trace, -$traceOffset);
57 foreach ($trace as &$frame) {
58 if (!isset($frame['type'])) {
59 // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
60 if (isset($frame['class'])) {
61 $frame['type'] = '::';
63 } elseif ('dynamic' === $frame['type']) {
64 $frame['type'] = '->';
65 } elseif ('static' === $frame['type']) {
66 $frame['type'] = '::';
69 // XDebug also has a different name for the parameters array
71 unset($frame['params'], $frame['args']);
72 } elseif (isset($frame['params']) && !isset($frame['args'])) {
73 $frame['args'] = $frame['params'];
74 unset($frame['params']);
79 $trace = array_reverse($trace);
80 } elseif (function_exists('symfony_debug_backtrace')) {
81 $trace = symfony_debug_backtrace();
82 if (0 < $traceOffset) {
83 array_splice($trace, 0, $traceOffset);
89 $this->setTrace($trace);
93 protected function setTrace($trace)
95 $traceReflector = new \ReflectionProperty('Exception', 'trace');
96 $traceReflector->setAccessible(true);
97 $traceReflector->setValue($this, $trace);