diff --git a/system/ThirdParty/Kint/Parser/ClassStaticsPlugin.php b/system/ThirdParty/Kint/Parser/ClassStaticsPlugin.php index 17fa84ff3719..8a18a00aee31 100644 --- a/system/ThirdParty/Kint/Parser/ClassStaticsPlugin.php +++ b/system/ThirdParty/Kint/Parser/ClassStaticsPlugin.php @@ -30,7 +30,6 @@ use Kint\Value\AbstractValue; use Kint\Value\Context\ClassConstContext; use Kint\Value\Context\ClassDeclaredContext; -use Kint\Value\Context\ClassOwnedContext; use Kint\Value\Context\StaticPropertyContext; use Kint\Value\InstanceValue; use Kint\Value\Representation\ContainerRepresentation; @@ -42,7 +41,7 @@ class ClassStaticsPlugin extends AbstractPlugin implements PluginCompleteInterface { - /** @psalm-var array>> */ + /** @psalm-var array>> */ private array $cache = []; public function getTypes(): array @@ -69,162 +68,163 @@ public function parseComplete(&$var, AbstractValue $v, int $trigger): AbstractVa return $v; } - $class = $v->getClassName(); - $parser = $this->getParser(); - $r = new ReflectionClass($class); + $deep = 0 === $this->getParser()->getDepthLimit(); - $statics_full_name = false; - $statics = []; - $props = $r->getProperties(ReflectionProperty::IS_STATIC); - foreach ($props as $prop) { - $statics[$prop->name] = $prop; - } + $r = new ReflectionClass($v->getClassName()); - $parent = $r; - while ($parent = $parent->getParentClass()) { - foreach ($parent->getProperties(ReflectionProperty::IS_STATIC) as $static) { - if (isset($statics[$static->name]) && $statics[$static->name]->getDeclaringClass()->name === $static->getDeclaringClass()->name) { - continue; - } - $statics[] = $static; - } + if ($statics = $this->getStatics($r, $v->getContext()->getDepth() + 1)) { + $v->addRepresentation(new ContainerRepresentation('Static properties', \array_values($statics), 'statics')); } - $statics_parsed = []; - $found_statics = []; + if ($consts = $this->getCachedConstants($r, $deep)) { + $v->addRepresentation(new ContainerRepresentation('Class constants', \array_values($consts), 'constants')); + } - $cdepth = $v->getContext()->getDepth(); + return $v; + } - foreach ($statics as $static) { - $prop = new StaticPropertyContext( - '$'.$static->getName(), - $static->getDeclaringClass()->name, - ClassDeclaredContext::ACCESS_PUBLIC - ); - $prop->depth = $cdepth + 1; - $prop->final = KINT_PHP84 && $static->isFinal(); + /** @psalm-return array */ + private function getStatics(ReflectionClass $r, int $depth): array + { + $cdepth = $depth ?: 1; + $class = $r->getName(); + $parent = $r->getParentClass(); - if ($static->isProtected()) { - $prop->access = ClassDeclaredContext::ACCESS_PROTECTED; - } elseif ($static->isPrivate()) { - $prop->access = ClassDeclaredContext::ACCESS_PRIVATE; - } + $parent_statics = $parent ? $this->getStatics($parent, $depth) : []; + $statics = []; - if ($prop->isAccessible($parser->getCallerClass())) { - $prop->access_path = '\\'.$prop->owner_class.'::'.$prop->name; - } + foreach ($r->getProperties(ReflectionProperty::IS_STATIC) as $pr) { + $canon_name = \strtolower($pr->getDeclaringClass()->name.'::'.$pr->name); - if (isset($found_statics[$prop->name])) { - $statics_full_name = true; + if ($pr->getDeclaringClass()->name === $class) { + $statics[$canon_name] = $this->buildStaticValue($pr, $cdepth); + } elseif (isset($parent_statics[$canon_name])) { + $statics[$canon_name] = $parent_statics[$canon_name]; + unset($parent_statics[$canon_name]); } else { - $found_statics[$prop->name] = true; - - if ($prop->owner_class !== $class && ClassDeclaredContext::ACCESS_PRIVATE === $prop->access) { - $statics_full_name = true; - } + // This should never happen since abstract static properties can't exist + $statics[$canon_name] = $this->buildStaticValue($pr, $cdepth); // @codeCoverageIgnore } + } - if ($statics_full_name) { - $prop->name = $prop->owner_class.'::'.$prop->name; - } + foreach ($parent_statics as $canon_name => $value) { + $statics[$canon_name] = $value; + } - $static->setAccessible(true); + return $statics; + } - /** - * @psalm-suppress TooFewArguments - * Appears to have been fixed in master - */ - if (!$static->isInitialized()) { - $statics_parsed[] = new UninitializedValue($prop); - } else { - $static = $static->getValue(); - $statics_parsed[] = $parser->parse($static, $prop); - } + private function buildStaticValue(ReflectionProperty $pr, int $depth): AbstractValue + { + $context = new StaticPropertyContext( + $pr->name, + $pr->getDeclaringClass()->name, + ClassDeclaredContext::ACCESS_PUBLIC + ); + $context->depth = $depth; + $context->final = KINT_PHP84 && $pr->isFinal(); + + if ($pr->isProtected()) { + $context->access = ClassDeclaredContext::ACCESS_PROTECTED; + } elseif ($pr->isPrivate()) { + $context->access = ClassDeclaredContext::ACCESS_PRIVATE; } - if ($statics_parsed) { - $v->addRepresentation(new ContainerRepresentation('Static properties', $statics_parsed, 'statics')); + $parser = $this->getParser(); + + if ($context->isAccessible($parser->getCallerClass())) { + $context->access_path = '\\'.$context->owner_class.'::$'.$context->name; } - if ($consts = $this->getCachedConstants($r)) { - $v->addRepresentation(new ContainerRepresentation('Class constants', $consts, 'constants')); + $pr->setAccessible(true); + + /** + * @psalm-suppress TooFewArguments + * Appears to have been fixed in master. + */ + if (!$pr->isInitialized()) { + $context->access_path = null; + + return new UninitializedValue($context); } - return $v; + $val = $pr->getValue(); + + $out = $this->getParser()->parse($val, $context); + $context->access_path = null; + + return $out; } - /** @psalm-return list */ - private function getCachedConstants(ReflectionClass $r): array + /** @psalm-return array */ + private function getCachedConstants(ReflectionClass $r, bool $deep): array { $parser = $this->getParser(); - $pdepth = $parser->getDepthLimit(); - $pdepth_enabled = (int) ($pdepth > 0); + $cdepth = $parser->getDepthLimit() ?: 1; + $deepkey = (int) $deep; $class = $r->getName(); // Separate cache for dumping with/without depth limit // This means we can do immediate depth limit on normal dumps - if (!isset($this->cache[$class][$pdepth_enabled])) { + if (!isset($this->cache[$class][$deepkey])) { $consts = []; - $reflectors = []; + $parent_consts = []; + if ($parent = $r->getParentClass()) { + $parent_consts = $this->getCachedConstants($parent, $deep); + } foreach ($r->getConstants() as $name => $val) { $cr = new ReflectionClassConstant($class, $name); // Skip enum constants - if (\is_a($cr->class, UnitEnum::class, true) && $val instanceof UnitEnum && $cr->class === \get_class($val)) { + if ($cr->class === $class && \is_a($class, UnitEnum::class, true)) { continue; } - $reflectors[$cr->name] = [$cr, $val]; - $consts[$cr->name] = null; - } + $canon_name = \strtolower($cr->getDeclaringClass()->name.'::'.$name); - if ($r = $r->getParentClass()) { - $parents = $this->getCachedConstants($r); - - foreach ($parents as $value) { - $c = $value->getContext(); - $cname = $c->getName(); - - if (isset($reflectors[$cname]) && $c instanceof ClassOwnedContext && $reflectors[$cname][0]->getDeclaringClass()->name === $c->owner_class) { - $consts[$cname] = $value; - unset($reflectors[$cname]); - } else { - $value = clone $value; - $c = $value->getContext(); - if ($c instanceof ClassOwnedContext) { - $c->name = $c->owner_class.'::'.$cname; - } - $consts[] = $value; - } - } - } + if ($cr->getDeclaringClass()->name === $class) { + $context = $this->buildConstContext($cr); + $context->depth = $cdepth; - foreach ($reflectors as [$cr, $val]) { - $context = new ClassConstContext( - $cr->name, - $cr->getDeclaringClass()->name, - ClassDeclaredContext::ACCESS_PUBLIC - ); - $context->depth = $pdepth ?: 1; - $context->final = KINT_PHP81 && $cr->isFinal(); - - if ($cr->isProtected()) { - $context->access = ClassDeclaredContext::ACCESS_PROTECTED; - } elseif ($cr->isPrivate()) { - $context->access = ClassDeclaredContext::ACCESS_PRIVATE; + $consts[$canon_name] = $parser->parse($val, $context); + $context->access_path = null; + } elseif (isset($parent_consts[$canon_name])) { + $consts[$canon_name] = $parent_consts[$canon_name]; } else { - // No access path for protected/private. Tough shit the cache is worth it - $context->access_path = '\\'.$context->owner_class.'::'.$context->name; + $context = $this->buildConstContext($cr); + $context->depth = $cdepth; + + $consts[$canon_name] = $parser->parse($val, $context); + $context->access_path = null; } - $consts[$cr->name] = $parser->parse($val, $context); + unset($parent_consts[$canon_name]); } - /** @psalm-var AbstractValue[] $consts */ - $this->cache[$class][$pdepth_enabled] = \array_values($consts); + $this->cache[$class][$deepkey] = $consts + $parent_consts; + } + + return $this->cache[$class][$deepkey]; + } + + private function buildConstContext(ReflectionClassConstant $cr): ClassConstContext + { + $context = new ClassConstContext( + $cr->name, + $cr->getDeclaringClass()->name, + ClassDeclaredContext::ACCESS_PUBLIC + ); + $context->final = KINT_PHP81 && $cr->isFinal(); + + if ($cr->isProtected()) { + $context->access = ClassDeclaredContext::ACCESS_PROTECTED; + } elseif ($cr->isPrivate()) { + $context->access = ClassDeclaredContext::ACCESS_PRIVATE; + } else { + $context->access_path = '\\'.$context->owner_class.'::'.$context->name; } - return $this->cache[$class][$pdepth_enabled]; + return $context; } } diff --git a/system/ThirdParty/Kint/Parser/DomPlugin.php b/system/ThirdParty/Kint/Parser/DomPlugin.php index d12e2f4cc8d9..358c0b917094 100644 --- a/system/ThirdParty/Kint/Parser/DomPlugin.php +++ b/system/ThirdParty/Kint/Parser/DomPlugin.php @@ -102,9 +102,14 @@ class DomPlugin extends AbstractPlugin implements PluginBeginInterface 'previousElementSibling' => true, 'nextElementSibling' => true, 'innerHTML' => false, + 'outerHTML' => false, 'substitutedNodeValue' => false, ]; + public const DOM_NS_VERSIONS = [ + 'outerHTML' => KINT_PHP85, + ]; + /** * @psalm-var non-empty-array Property names to readable status */ @@ -458,6 +463,16 @@ public static function getKnownProperties(object $var): array if ($var instanceof Attr || $var instanceof CharacterData) { $known_properties['nodeValue'] = false; } + + foreach (self::DOM_NS_VERSIONS as $key => $val) { + /** + * @psalm-var bool $val + * Psalm bug #4509 + */ + if (false === $val) { + unset($known_properties[$key]); // @codeCoverageIgnore + } + } } else { $known_properties = self::DOMNODE_PROPS; if ($var instanceof DOMElement) { diff --git a/system/ThirdParty/Kint/Parser/IteratorPlugin.php b/system/ThirdParty/Kint/Parser/IteratorPlugin.php index fff51ee491d7..31b037acc0f4 100644 --- a/system/ThirdParty/Kint/Parser/IteratorPlugin.php +++ b/system/ThirdParty/Kint/Parser/IteratorPlugin.php @@ -54,7 +54,7 @@ class IteratorPlugin extends AbstractPlugin implements PluginCompleteInterface * when traversed. Others are just huge. Either way, put them in here * and you won't have to worry about them being parsed. * - * @psalm-var class-string[] + * @psalm-var class-string[] */ public static array $blacklist = [ NamedNodeMap::class, diff --git a/system/ThirdParty/Kint/Parser/Parser.php b/system/ThirdParty/Kint/Parser/Parser.php index b609edb08c97..a3c2fbb01468 100644 --- a/system/ThirdParty/Kint/Parser/Parser.php +++ b/system/ThirdParty/Kint/Parser/Parser.php @@ -28,7 +28,6 @@ namespace Kint\Parser; use DomainException; -use Exception; use InvalidArgumentException; use Kint\Utils; use Kint\Value\AbstractValue; @@ -52,6 +51,7 @@ use ReflectionObject; use ReflectionProperty; use ReflectionReference; +use Throwable; /** * @psalm-type ParserTrigger int-mask-of @@ -173,6 +173,12 @@ public function parse(&$var, ContextInterface $c): AbstractValue public function addPlugin(PluginInterface $p): void { + try { + $this->noRecurseCall(); + } catch (DomainException $e) { // @codeCoverageIgnore + \trigger_error('Calling Kint\\Parser::addPlugin from inside a parse is deprecated', E_USER_DEPRECATED); // @codeCoverageIgnore + } + if (!$types = $p->getTypes()) { return; } @@ -209,6 +215,12 @@ public function addPlugin(PluginInterface $p): void public function clearPlugins(): void { + try { + $this->noRecurseCall(); + } catch (DomainException $e) { // @codeCoverageIgnore + \trigger_error('Calling Kint\\Parser::clearPlugins from inside a parse is deprecated', E_USER_DEPRECATED); // @codeCoverageIgnore + } + $this->plugins = []; } @@ -216,17 +228,13 @@ protected function noRecurseCall(): void { $bt = \debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS); - $caller_frame = [ - 'function' => __FUNCTION__, - ]; - - while (isset($bt[0]['object']) && $bt[0]['object'] === $this) { - $caller_frame = \array_shift($bt); - } + \reset($bt); + /** @psalm-var class-string $caller_frame['class'] */ + $caller_frame = \next($bt); foreach ($bt as $frame) { - if (isset($frame['object']) && $frame['object'] === $this) { - throw new DomainException(__CLASS__.'::'.$caller_frame['function'].' cannot be called from inside a parse'); + if (isset($frame['object']) && $frame['object'] === $this && 'parse' === $frame['function']) { + throw new DomainException($caller_frame['class'].'::'.$caller_frame['function'].' cannot be called from inside a parse'); } } } @@ -265,45 +273,41 @@ private function parseArray(array &$var, ContextInterface $c): AbstractValue return $this->applyPluginsComplete($var, $array, self::TRIGGER_RECURSION); } - $this->array_ref_stack[$parentRef] = true; + try { + $this->array_ref_stack[$parentRef] = true; - $cdepth = $c->getDepth(); - $ap = $c->getAccessPath(); + $cdepth = $c->getDepth(); + $ap = $c->getAccessPath(); - if ($size > 0 && $this->depth_limit && $cdepth >= $this->depth_limit) { - $array = new ArrayValue($c, $size, $contents); - $array->flags |= AbstractValue::FLAG_DEPTH_LIMIT; + if ($size > 0 && $this->depth_limit && $cdepth >= $this->depth_limit) { + $array = new ArrayValue($c, $size, $contents); + $array->flags |= AbstractValue::FLAG_DEPTH_LIMIT; - $array = $this->applyPluginsComplete($var, $array, self::TRIGGER_DEPTH_LIMIT); - - unset($this->array_ref_stack[$parentRef]); + return $this->applyPluginsComplete($var, $array, self::TRIGGER_DEPTH_LIMIT); + } - return $array; - } + foreach ($var as $key => $_) { + $child = new ArrayContext($key); + $child->depth = $cdepth + 1; + $child->reference = null !== ReflectionReference::fromArrayElement($var, $key); - foreach ($var as $key => $_) { - $child = new ArrayContext($key); - $child->depth = $cdepth + 1; - $child->reference = null !== ReflectionReference::fromArrayElement($var, $key); + if (null !== $ap) { + $child->access_path = $ap.'['.\var_export($key, true).']'; + } - if (null !== $ap) { - $child->access_path = $ap.'['.\var_export($key, true).']'; + $contents[$key] = $this->parse($var[$key], $child); } - $contents[$key] = $this->parse($var[$key], $child); - } + $array = new ArrayValue($c, $size, $contents); - $array = new ArrayValue($c, $size, $contents); + if ($contents) { + $array->addRepresentation(new ContainerRepresentation('Contents', $contents, null, true)); + } - if ($contents) { - $array->addRepresentation(new ContainerRepresentation('Contents', $contents, null, true)); + return $this->applyPluginsComplete($var, $array, self::TRIGGER_SUCCESS); + } finally { + unset($this->array_ref_stack[$parentRef]); } - - $array = $this->applyPluginsComplete($var, $array, self::TRIGGER_SUCCESS); - - unset($this->array_ref_stack[$parentRef]); - - return $array; } /** @@ -374,129 +378,126 @@ private function parseObject(object &$var, ContextInterface $c): AbstractValue return $this->applyPluginsComplete($var, $object, self::TRIGGER_RECURSION); } - $this->object_hashes[$hash] = true; + try { + $this->object_hashes[$hash] = true; - $cdepth = $c->getDepth(); - $ap = $c->getAccessPath(); + $cdepth = $c->getDepth(); + $ap = $c->getAccessPath(); - if ($this->depth_limit && $cdepth >= $this->depth_limit) { - $object = new InstanceValue($c, $classname, $hash, \spl_object_id($var)); - $object->flags |= AbstractValue::FLAG_DEPTH_LIMIT; + if ($this->depth_limit && $cdepth >= $this->depth_limit) { + $object = new InstanceValue($c, $classname, $hash, \spl_object_id($var)); + $object->flags |= AbstractValue::FLAG_DEPTH_LIMIT; - $object = $this->applyPluginsComplete($var, $object, self::TRIGGER_DEPTH_LIMIT); - - unset($this->object_hashes[$hash]); - - return $object; - } - - if (KINT_PHP81) { - $props = $this->getPropsOrdered(new ReflectionObject($var)); - } else { - $props = $this->getPropsOrderedOld(new ReflectionObject($var)); // @codeCoverageIgnore - } - - $values = (array) $var; - $properties = []; - - foreach ($props as $rprop) { - $rprop->setAccessible(true); - $name = $rprop->getName(); - - // Casting object to array: - // private properties show in the form "\0$owner_class_name\0$property_name"; - // protected properties show in the form "\0*\0$property_name"; - // public properties show in the form "$property_name"; - // http://www.php.net/manual/en/language.types.array.php#language.types.array.casting - $key = $name; - if ($rprop->isProtected()) { - $key = "\0*\0".$name; - } elseif ($rprop->isPrivate()) { - $key = "\0".$rprop->getDeclaringClass()->getName()."\0".$name; + return $this->applyPluginsComplete($var, $object, self::TRIGGER_DEPTH_LIMIT); } - $initialized = \array_key_exists($key, $values); - if ($key === (string) (int) $key) { - $key = (int) $key; + + if (KINT_PHP81) { + $props = $this->getPropsOrdered(new ReflectionObject($var)); + } else { + $props = $this->getPropsOrderedOld(new ReflectionObject($var)); // @codeCoverageIgnore } - if ($rprop->isDefault()) { - $child = new PropertyContext( - $name, - $rprop->getDeclaringClass()->getName(), - ClassDeclaredContext::ACCESS_PUBLIC - ); + $values = (array) $var; + $properties = []; - $child->readonly = KINT_PHP81 && $rprop->isReadOnly(); + foreach ($props as $rprop) { + $rprop->setAccessible(true); + $name = $rprop->getName(); + // Casting object to array: + // private properties show in the form "\0$owner_class_name\0$property_name"; + // protected properties show in the form "\0*\0$property_name"; + // public properties show in the form "$property_name"; + // http://www.php.net/manual/en/language.types.array.php#language.types.array.casting + $key = $name; if ($rprop->isProtected()) { - $child->access = ClassDeclaredContext::ACCESS_PROTECTED; + $key = "\0*\0".$name; } elseif ($rprop->isPrivate()) { - $child->access = ClassDeclaredContext::ACCESS_PRIVATE; + $key = "\0".$rprop->getDeclaringClass()->getName()."\0".$name; + } + $initialized = \array_key_exists($key, $values); + if ($key === (string) (int) $key) { + $key = (int) $key; } - if (KINT_PHP84) { - if ($rprop->isProtectedSet()) { - $child->access_set = ClassDeclaredContext::ACCESS_PROTECTED; - } elseif ($rprop->isPrivateSet()) { - $child->access_set = ClassDeclaredContext::ACCESS_PRIVATE; + if ($rprop->isDefault()) { + $child = new PropertyContext( + $name, + $rprop->getDeclaringClass()->getName(), + ClassDeclaredContext::ACCESS_PUBLIC + ); + + $child->readonly = KINT_PHP81 && $rprop->isReadOnly(); + + if ($rprop->isProtected()) { + $child->access = ClassDeclaredContext::ACCESS_PROTECTED; + } elseif ($rprop->isPrivate()) { + $child->access = ClassDeclaredContext::ACCESS_PRIVATE; } - $hooks = $rprop->getHooks(); - if (isset($hooks['get'])) { - $child->hooks |= PropertyContext::HOOK_GET; - if ($hooks['get']->returnsReference()) { - $child->hooks |= PropertyContext::HOOK_GET_REF; + if (KINT_PHP84) { + if ($rprop->isProtectedSet()) { + $child->access_set = ClassDeclaredContext::ACCESS_PROTECTED; + } elseif ($rprop->isPrivateSet()) { + $child->access_set = ClassDeclaredContext::ACCESS_PRIVATE; } - } - if (isset($hooks['set'])) { - $child->hooks |= PropertyContext::HOOK_SET; - - $child->hook_set_type = (string) $rprop->getSettableType(); - if ($child->hook_set_type !== (string) $rprop->getType()) { - $child->hooks |= PropertyContext::HOOK_SET_TYPE; - } elseif ('' === $child->hook_set_type) { - $child->hook_set_type = null; + + $hooks = $rprop->getHooks(); + if (isset($hooks['get'])) { + $child->hooks |= PropertyContext::HOOK_GET; + if ($hooks['get']->returnsReference()) { + $child->hooks |= PropertyContext::HOOK_GET_REF; + } + } + if (isset($hooks['set'])) { + $child->hooks |= PropertyContext::HOOK_SET; + + $child->hook_set_type = (string) $rprop->getSettableType(); + if ($child->hook_set_type !== (string) $rprop->getType()) { + $child->hooks |= PropertyContext::HOOK_SET_TYPE; + } elseif ('' === $child->hook_set_type) { + $child->hook_set_type = null; + } } } + } else { + $child = new ClassOwnedContext($name, $rprop->getDeclaringClass()->getName()); } - } else { - $child = new ClassOwnedContext($name, $rprop->getDeclaringClass()->getName()); - } - $child->reference = $initialized && null !== ReflectionReference::fromArrayElement($values, $key); - $child->depth = $cdepth + 1; + $child->reference = $initialized && null !== ReflectionReference::fromArrayElement($values, $key); + $child->depth = $cdepth + 1; + + if (null !== $ap && $child->isAccessible($this->caller_class)) { + /** @psalm-var string $child->name */ + if (Utils::isValidPhpName($child->name)) { + $child->access_path = $ap.'->'.$child->name; + } else { + $child->access_path = $ap.'->{'.\var_export($child->name, true).'}'; + } + } - if (null !== $ap && $child->isAccessible($this->caller_class)) { - /** @psalm-var string $child->name */ - if (Utils::isValidPhpName($child->name)) { - $child->access_path = $ap.'->'.$child->name; + if (KINT_PHP84 && $rprop->isVirtual()) { + $properties[] = new VirtualValue($child); + } elseif (!$initialized) { + $properties[] = new UninitializedValue($child); } else { - $child->access_path = $ap.'->{'.\var_export($child->name, true).'}'; + $properties[] = $this->parse($values[$key], $child); } } - if (KINT_PHP84 && $rprop->isVirtual()) { - $properties[] = new VirtualValue($child); - } elseif (!$initialized) { - $properties[] = new UninitializedValue($child); - } else { - $properties[] = $this->parse($values[$key], $child); + $object = new InstanceValue($c, $classname, $hash, \spl_object_id($var)); + if ($props) { + $object->setChildren($properties); } - } - $object = new InstanceValue($c, $classname, $hash, \spl_object_id($var)); - if ($props) { - $object->setChildren($properties); - } + if ($properties) { + $object->addRepresentation(new ContainerRepresentation('Properties', $properties)); + } - if ($properties) { - $object->addRepresentation(new ContainerRepresentation('Properties', $properties)); + return $this->applyPluginsComplete($var, $object, self::TRIGGER_SUCCESS); + } finally { + unset($this->object_hashes[$hash]); } - - $object = $this->applyPluginsComplete($var, $object, self::TRIGGER_SUCCESS); - unset($this->object_hashes[$hash]); - - return $object; } /** @@ -555,9 +556,9 @@ private function applyPluginsBegin(&$var, ContextInterface $c, string $type): ?A if ($v = $plugin->parseBegin($var, $c)) { return $v; } - } catch (Exception $e) { + } catch (Throwable $e) { \trigger_error( - 'An exception ('.Utils::errorSanitizeString(\get_class($e)).') was thrown in '.$e->getFile().' on line '.$e->getLine().' while executing "'.Utils::errorSanitizeString(\get_class($plugin)).'"->parseBegin. Error message: '.Utils::errorSanitizeString($e->getMessage()), + Utils::errorSanitizeString(\get_class($e)).' was thrown in '.$e->getFile().' on line '.$e->getLine().' while executing '.Utils::errorSanitizeString(\get_class($plugin)).'->parseBegin. Error message: '.Utils::errorSanitizeString($e->getMessage()), E_USER_WARNING ); } @@ -578,9 +579,9 @@ private function applyPluginsComplete(&$var, AbstractValue $v, int $trigger): Ab foreach ($plugins as $plugin) { try { $v = $plugin->parseComplete($var, $v, $trigger); - } catch (Exception $e) { + } catch (Throwable $e) { \trigger_error( - 'An exception ('.Utils::errorSanitizeString(\get_class($e)).') was thrown in '.$e->getFile().' on line '.$e->getLine().' while executing "'.Utils::errorSanitizeString(\get_class($plugin)).'"->parseComplete. Error message: '.Utils::errorSanitizeString($e->getMessage()), + Utils::errorSanitizeString(\get_class($e)).' was thrown in '.$e->getFile().' on line '.$e->getLine().' while executing '.Utils::errorSanitizeString(\get_class($plugin)).'->parseComplete. Error message: '.Utils::errorSanitizeString($e->getMessage()), E_USER_WARNING ); } diff --git a/system/ThirdParty/Kint/Renderer/AssetRendererTrait.php b/system/ThirdParty/Kint/Renderer/AssetRendererTrait.php index 11bf9547c4b4..fb66f2db1b7b 100644 --- a/system/ThirdParty/Kint/Renderer/AssetRendererTrait.php +++ b/system/ThirdParty/Kint/Renderer/AssetRendererTrait.php @@ -31,7 +31,7 @@ trait AssetRendererTrait { public static ?string $theme = null; - /** @psalm-var array{js?:string, css?:array} */ + /** @psalm-var array{js?:string, css?:array} */ private static array $assetCache = []; /** @psalm-api */ @@ -54,11 +54,17 @@ public static function renderCss(): ?string if (!isset(self::$assetCache['css'][self::$theme])) { if (\file_exists(KINT_DIR.'/resources/compiled/'.self::$theme)) { self::$assetCache['css'][self::$theme] = \file_get_contents(KINT_DIR.'/resources/compiled/'.self::$theme); - } else { + } elseif (\file_exists(self::$theme)) { self::$assetCache['css'][self::$theme] = \file_get_contents(self::$theme); + } else { + self::$assetCache['css'][self::$theme] = false; } } + if (false === self::$assetCache['css'][self::$theme]) { + return null; + } + return self::$assetCache['css'][self::$theme]; } } diff --git a/system/ThirdParty/Kint/Renderer/Rich/TraceFramePlugin.php b/system/ThirdParty/Kint/Renderer/Rich/TraceFramePlugin.php index 3d2ceb2b22f3..7ce87b5d6af9 100644 --- a/system/ThirdParty/Kint/Renderer/Rich/TraceFramePlugin.php +++ b/system/ThirdParty/Kint/Renderer/Rich/TraceFramePlugin.php @@ -28,6 +28,7 @@ namespace Kint\Renderer\Rich; use Kint\Value\AbstractValue; +use Kint\Value\MethodValue; use Kint\Value\TraceFrameValue; class TraceFramePlugin extends AbstractPlugin implements ValuePluginInterface @@ -45,7 +46,13 @@ public function renderValue(AbstractValue $v): ?string } if ($callable = $v->getCallable()) { - $function = $this->renderer->escape($callable->getDisplayName()); + if ($callable instanceof MethodValue) { + $function = $callable->getFullyQualifiedDisplayName(); + } else { + $function = $callable->getDisplayName(); + } + + $function = $this->renderer->escape($function); if (null !== ($url = $callable->getPhpDocUrl())) { $function = ''.$function.''; diff --git a/system/ThirdParty/Kint/Renderer/RichRenderer.php b/system/ThirdParty/Kint/Renderer/RichRenderer.php index cda4d9fb5e96..3a8fdc6f8dab 100644 --- a/system/ThirdParty/Kint/Renderer/RichRenderer.php +++ b/system/ThirdParty/Kint/Renderer/RichRenderer.php @@ -221,15 +221,15 @@ public function renderHeaderWrapper(ContextInterface $c, bool $has_children, str $out .= '>'; if (self::$access_paths && $c->getDepth() > 0 && null !== ($ap = $c->getAccessPath())) { - $out .= ''; + $out .= ''; } if ($has_children) { if (0 === $c->getDepth()) { if (!$this->use_folder) { - $out .= ''; + $out .= ''; } - $out .= ''; + $out .= ''; $out .= ''; } @@ -412,7 +412,13 @@ public function postRender(): string return ''; } - $output = '