composer package updates
[openemr.git] / vendor / symfony / debug / Exception / FatalErrorException.php
blob6ddfc4c200416ad30bdcfbd045f900d3cc9db5f3
1 <?php
3 /*
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\Debug\Exception;
14 /**
15 * Fatal Error Exception.
17 * @author Konstanton Myakshin <koc-dp@yandex.ru>
19 class FatalErrorException extends \ErrorException
21 public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
23 parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
25 if (null !== $trace) {
26 if (!$traceArgs) {
27 foreach ($trace as &$frame) {
28 unset($frame['args'], $frame['this'], $frame);
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);
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'] = '::';
46 } elseif ('dynamic' === $frame['type']) {
47 $frame['type'] = '->';
48 } elseif ('static' === $frame['type']) {
49 $frame['type'] = '::';
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']);
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);
68 } else {
69 $trace = array();
72 $this->setTrace($trace);
76 protected function setTrace($trace)
78 $traceReflector = new \ReflectionProperty('Exception', 'trace');
79 $traceReflector->setAccessible(true);
80 $traceReflector->setValue($this, $trace);