1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,77 +0,0 @@ |
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(string $message, int $code, int $severity, string $filename, int $lineno, int $traceOffset = null, bool $traceArgs = true, array $trace = null, \Throwable $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 |
- } else { |
|
64 |
- $trace = []; |
|
65 |
- } |
|
66 |
- |
|
67 |
- $this->setTrace($trace); |
|
68 |
- } |
|
69 |
- } |
|
70 |
- |
|
71 |
- protected function setTrace($trace) |
|
72 |
- { |
|
73 |
- $traceReflector = new \ReflectionProperty('Exception', 'trace'); |
|
74 |
- $traceReflector->setAccessible(true); |
|
75 |
- $traceReflector->setValue($this, $trace); |
|
76 |
- } |
|
77 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,77 @@ |
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(string $message, int $code, int $severity, string $filename, int $lineno, int $traceOffset = null, bool $traceArgs = true, array $trace = null, \Throwable $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 |
+ } else { |
|
64 |
+ $trace = []; |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ $this->setTrace($trace); |
|
68 |
+ } |
|
69 |
+ } |
|
70 |
+ |
|
71 |
+ protected function setTrace($trace) |
|
72 |
+ { |
|
73 |
+ $traceReflector = new \ReflectionProperty('Exception', 'trace'); |
|
74 |
+ $traceReflector->setAccessible(true); |
|
75 |
+ $traceReflector->setValue($this, $trace); |
|
76 |
+ } |
|
77 |
+} |