From 213fd504ef3b0636fb9d052f817fcdf9bff6e863 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 27 Apr 2024 10:43:45 +0900 Subject: [PATCH] chore: update Kint to 5.1.1 --- system/ThirdParty/Kint/Parser/FsPathPlugin.php | 10 ++++++++-- system/ThirdParty/Kint/Parser/MysqliPlugin.php | 3 ++- system/ThirdParty/Kint/Zval/BlobValue.php | 4 +++- .../Zval/Representation/SplFileInfoRepresentation.php | 2 +- system/ThirdParty/Kint/init.php | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/system/ThirdParty/Kint/Parser/FsPathPlugin.php b/system/ThirdParty/Kint/Parser/FsPathPlugin.php index 7ec49de109cc..1a98c6dcd134 100644 --- a/system/ThirdParty/Kint/Parser/FsPathPlugin.php +++ b/system/ThirdParty/Kint/Parser/FsPathPlugin.php @@ -30,6 +30,7 @@ use Kint\Zval\Representation\SplFileInfoRepresentation; use Kint\Zval\Value; use SplFileInfo; +use TypeError; class FsPathPlugin extends AbstractPlugin { @@ -59,8 +60,13 @@ public function parse(&$var, Value &$o, int $trigger): void return; } - if (!@\file_exists($var)) { - return; + try { + if (!@\file_exists($var)) { + return; + } + } catch (TypeError $e) {// @codeCoverageIgnore + // Only possible in PHP 7 + return; // @codeCoverageIgnore } if (\in_array($var, self::$blacklist, true)) { diff --git a/system/ThirdParty/Kint/Parser/MysqliPlugin.php b/system/ThirdParty/Kint/Parser/MysqliPlugin.php index 90a4abd6b511..22a23a901ccb 100644 --- a/system/ThirdParty/Kint/Parser/MysqliPlugin.php +++ b/system/ThirdParty/Kint/Parser/MysqliPlugin.php @@ -105,7 +105,8 @@ public function parse(&$var, Value &$o, int $trigger): void foreach ($o->value->contents as $key => $obj) { if (isset($this->connected_readable[$obj->name])) { if (!$connected) { - continue; + // No failed connections after PHP 8.1 + continue; // @codeCoverageIgnore } } elseif (isset($this->empty_readable[$obj->name])) { // No failed connections after PHP 8.1 diff --git a/system/ThirdParty/Kint/Zval/BlobValue.php b/system/ThirdParty/Kint/Zval/BlobValue.php index 5e9f129d1181..66f60fdb9043 100644 --- a/system/ThirdParty/Kint/Zval/BlobValue.php +++ b/system/ThirdParty/Kint/Zval/BlobValue.php @@ -182,7 +182,9 @@ public static function detectEncoding(string $string) if (\function_exists('iconv')) { foreach (self::$legacy_encodings as $encoding) { // Iconv detection works by triggering - // "Detected an illegal character in input string" warnings + // "Detected an illegal character in input string" notices + // This notice does not become a TypeError with strict_types + // so we don't have to wrap this in a try catch if (@\iconv($encoding, $encoding, $string) === $string) { return $encoding; } diff --git a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php index 6424ee6a9175..dad9d04cdc9e 100644 --- a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php +++ b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php @@ -76,7 +76,7 @@ public function __construct(SplFileInfo $fileInfo) } } catch (RuntimeException $e) { if (false === \strpos($e->getMessage(), ' open_basedir ')) { - throw $e; + throw $e; // @codeCoverageIgnore } } diff --git a/system/ThirdParty/Kint/init.php b/system/ThirdParty/Kint/init.php index 039489ab43ad..d682d9a9dc36 100644 --- a/system/ThirdParty/Kint/init.php +++ b/system/ThirdParty/Kint/init.php @@ -51,7 +51,7 @@ if (false !== \ini_get('xdebug.file_link_format')) { Kint::$file_link_format = \ini_get('xdebug.file_link_format'); } -if (isset($_SERVER['DOCUMENT_ROOT'])) { +if (isset($_SERVER['DOCUMENT_ROOT']) && false === \strpos($_SERVER['DOCUMENT_ROOT'], "\0")) { Kint::$app_root_dirs = [ $_SERVER['DOCUMENT_ROOT'] => '', ];