Skip to content

Commit 3fd247d

Browse files
committed
Avoid mb_check_encoding deprecation
Appeared with PHP 8.1 when the value null is passed to mb_check_encoding by accident.
1 parent e225b5b commit 3fd247d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function sanitizeData($data): string
168168
// All other non-array values are fine
169169
if (!\is_array($data)) {
170170
// If parts of the string are not UTF8 we assume it to be a binary string
171-
if (!\mb_check_encoding($data, 'UTF-8')) {
171+
if (\is_string($data) && !\mb_check_encoding($data, 'UTF-8')) {
172172
return '0x' . \bin2hex($data);
173173
}
174174

vendor-bin/phpcs/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
33
"squizlabs/php_codesniffer": "^3.5",
4-
"slevomat/coding-standard": "^6.0"
4+
"slevomat/coding-standard": "^7.0"
55
}
66
}

vendor-bin/phpstan/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"phpstan/phpstan": "^0.12"
3+
"phpstan/phpstan": "^1.0"
44
}
55
}

0 commit comments

Comments
 (0)