Skip to content

Commit 86e142d

Browse files
authored
Merge pull request #7054 from kenjis/update-kint
chore: update Kint to 5.0.2
2 parents 5bee6d9 + 7558424 commit 86e142d

File tree

5 files changed

+35
-24
lines changed

5 files changed

+35
-24
lines changed

system/ThirdParty/Kint/Parser/XmlPlugin.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ protected static function xmlToSimpleXML(string $var, ?string $parent_path): ?ar
113113
/**
114114
* Get the DOMDocument info.
115115
*
116-
* The documentation of DOMDocument::loadXML() states that while you can
117-
* call it statically, it will give an E_STRICT warning. On my system it
118-
* actually gives an E_DEPRECATED warning, but it works so we'll just add
119-
* an error-silencing '@' to the access path.
120-
*
121116
* If it errors loading then we wouldn't have gotten this far in the first place.
122117
*
123118
* @psalm-param non-empty-string $var The XML string

system/ThirdParty/Kint/Zval/BlobValue.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ class BlobValue extends Value
7474
* windows-125x and iso-8859-x which have practically undetectable
7575
* differences because they use every single byte available.
7676
*
77-
* This is *NOT* reliable and should not be trusted implicitly. As
78-
* with char_encodings, the order of the charsets is significant.
77+
* This is *NOT* reliable and should not be trusted implicitly. Since it
78+
* works by triggering and suppressing conversion warnings, your error
79+
* handler may complain.
80+
*
81+
* As with char_encodings, the order of the charsets is significant.
7982
*
8083
* This depends on the iconv extension
8184
*/
@@ -182,6 +185,8 @@ public static function detectEncoding(string $string)
182185

183186
if (\function_exists('iconv')) {
184187
foreach (self::$legacy_encodings as $encoding) {
188+
// Iconv detection works by triggering
189+
// "Detected an illegal character in input string" warnings
185190
if (@\iconv($encoding, $encoding, $string) === $string) {
186191
return $encoding;
187192
}

system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
namespace Kint\Zval\Representation;
2929

3030
use Kint\Utils;
31+
use RuntimeException;
3132
use SplFileInfo;
3233

3334
class SplFileInfoRepresentation extends Representation
@@ -53,24 +54,30 @@ public function __construct(SplFileInfo $fileInfo)
5354
{
5455
parent::__construct('SplFileInfo');
5556

56-
if ($fileInfo->getRealPath()) {
57-
$this->realpath = $fileInfo->getRealPath();
58-
$this->perms = $fileInfo->getPerms();
59-
$this->size = $fileInfo->getSize();
60-
$this->owner = $fileInfo->getOwner();
61-
$this->group = $fileInfo->getGroup();
62-
$this->ctime = $fileInfo->getCTime();
63-
$this->mtime = $fileInfo->getMTime();
64-
}
65-
6657
$this->path = $fileInfo->getPathname();
6758

68-
$this->is_dir = $fileInfo->isDir();
69-
$this->is_file = $fileInfo->isFile();
70-
$this->is_link = $fileInfo->isLink();
59+
try {
60+
if ($fileInfo->getRealPath()) {
61+
$this->perms = $fileInfo->getPerms();
62+
$this->size = $fileInfo->getSize();
63+
$this->owner = $fileInfo->getOwner();
64+
$this->group = $fileInfo->getGroup();
65+
$this->ctime = $fileInfo->getCTime();
66+
$this->mtime = $fileInfo->getMTime();
67+
$this->realpath = $fileInfo->getRealPath();
68+
}
69+
70+
$this->is_dir = $fileInfo->isDir();
71+
$this->is_file = $fileInfo->isFile();
72+
$this->is_link = $fileInfo->isLink();
7173

72-
if ($this->is_link) {
73-
$this->linktarget = $fileInfo->getLinkTarget();
74+
if ($this->is_link) {
75+
$this->linktarget = $fileInfo->getLinkTarget();
76+
}
77+
} catch (RuntimeException $e) {
78+
if (false === \strpos($e->getMessage(), ' open_basedir ')) {
79+
throw $e;
80+
}
7481
}
7582

7683
switch ($this->perms & 0xF000) {

system/ThirdParty/Kint/init.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@
5353
if (isset($_SERVER['DOCUMENT_ROOT'])) {
5454
Kint::$app_root_dirs = [
5555
$_SERVER['DOCUMENT_ROOT'] => '<ROOT>',
56-
\realpath($_SERVER['DOCUMENT_ROOT']) => '<ROOT>',
5756
];
57+
58+
// Suppressed for unreadable document roots (related to open_basedir)
59+
if (false !== @\realpath($_SERVER['DOCUMENT_ROOT'])) {
60+
Kint::$app_root_dirs[\realpath($_SERVER['DOCUMENT_ROOT'])] = '<ROOT>';
61+
}
5862
}
5963

6064
Utils::composerSkipFlags();

user_guide_src/source/changelogs/v4.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ Others
322322
- **Validation:** Added Closure validation rule. See :ref:`validation-using-closure-rule` for details.
323323
- **Config:** Now you can specify Composer packages to auto-discover manually. See :ref:`Code Modules <modules-specify-composer-packages>`.
324324
- **Config:** Added ``Config\Session`` class to handle session configuration.
325-
- **Debug:** Kint has been updated to 5.0.1.
325+
- **Debug:** Kint has been updated to 5.0.2.
326326
- **Request:** Added new ``$request->getRawInputVar()`` method to return a specified variable from raw stream. See :ref:`Retrieving Raw data <incomingrequest-retrieving-raw-data>`.
327327
- **Request:** Added new ``$request->is()`` method to query the request type.
328328
See :ref:`Determining Request Type <incomingrequest-is>`.

0 commit comments

Comments
 (0)