1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 10:06:08 +02:00

Fix utf8_encode deprecation (#1722)

This commit is contained in:
erikn69
2022-07-22 07:23:53 -05:00
committed by GitHub
parent 83db4b3f81
commit 27dc1b2ef7
3 changed files with 10 additions and 10 deletions

View File

@@ -149,7 +149,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
}
$json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true);
$data = base64_encode(utf8_encode($json));
$data = base64_encode($json);
if (strlen($data) > 3 * 1024) {
self::$overflowed = true;
@@ -163,8 +163,8 @@ class ChromePHPHandler extends AbstractProcessingHandler
'extra' => [],
];
self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
$json = Utils::jsonEncode(self::$json, null, true);
$data = base64_encode(utf8_encode($json));
$json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true);
$data = base64_encode($json);
}
if (trim($data) !== '') {

View File

@@ -211,7 +211,7 @@ final class Utils
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
function ($m) {
return utf8_encode($m[0]);
return function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]);
},
$data
);