[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <[email protected]> 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\ErrorHandler\Error; 13 14 class FatalError extends \Error 15 { 16 private $error; 17 18 /** 19 * {@inheritdoc} 20 * 21 * @param array $error An array as returned by error_get_last() 22 */ 23 public function __construct(string $message, int $code, array $error, int $traceOffset = null, bool $traceArgs = true, array $trace = null) 24 { 25 parent::__construct($message, $code); 26 27 $this->error = $error; 28 29 if (null !== $trace) { 30 if (!$traceArgs) { 31 foreach ($trace as &$frame) { 32 unset($frame['args'], $frame['this'], $frame); 33 } 34 } 35 } elseif (null !== $traceOffset) { 36 if (\function_exists('xdebug_get_function_stack') && $trace = @xdebug_get_function_stack()) { 37 if (0 < $traceOffset) { 38 array_splice($trace, -$traceOffset); 39 } 40 41 foreach ($trace as &$frame) { 42 if (!isset($frame['type'])) { 43 // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695 44 if (isset($frame['class'])) { 45 $frame['type'] = '::'; 46 } 47 } elseif ('dynamic' === $frame['type']) { 48 $frame['type'] = '->'; 49 } elseif ('static' === $frame['type']) { 50 $frame['type'] = '::'; 51 } 52 53 // XDebug also has a different name for the parameters array 54 if (!$traceArgs) { 55 unset($frame['params'], $frame['args']); 56 } elseif (isset($frame['params']) && !isset($frame['args'])) { 57 $frame['args'] = $frame['params']; 58 unset($frame['params']); 59 } 60 } 61 62 unset($frame); 63 $trace = array_reverse($trace); 64 } else { 65 $trace = []; 66 } 67 } 68 69 foreach ([ 70 'file' => $error['file'], 71 'line' => $error['line'], 72 'trace' => $trace, 73 ] as $property => $value) { 74 if (null !== $value) { 75 $refl = new \ReflectionProperty(\Error::class, $property); 76 $refl->setAccessible(true); 77 $refl->setValue($this, $value); 78 } 79 } 80 } 81 82 /** 83 * {@inheritdoc} 84 */ 85 public function getError(): array 86 { 87 return $this->error; 88 } 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |