mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-01 19:00:20 +02:00
Fix utf8_encode deprecation (#1722)
This commit is contained in:
@@ -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) !== '') {
|
||||
|
@@ -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
|
||||
);
|
||||
|
@@ -38,7 +38,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
$handler->handle($this->getRecord(Logger::WARNING));
|
||||
|
||||
$expected = [
|
||||
'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode([
|
||||
'X-ChromeLogger-Data' => base64_encode(json_encode([
|
||||
'version' => '4.0',
|
||||
'columns' => ['label', 'log', 'backtrace', 'type'],
|
||||
'rows' => [
|
||||
@@ -46,7 +46,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
'test',
|
||||
],
|
||||
'request_uri' => '',
|
||||
]))),
|
||||
])),
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $handler->getHeaders());
|
||||
@@ -72,7 +72,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
$handler->handle($this->getRecord(Logger::WARNING, str_repeat('b', 2 * 1024)));
|
||||
|
||||
$expected = [
|
||||
'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode([
|
||||
'X-ChromeLogger-Data' => base64_encode(json_encode([
|
||||
'version' => '4.0',
|
||||
'columns' => ['label', 'log', 'backtrace', 'type'],
|
||||
'rows' => [
|
||||
@@ -96,7 +96,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
],
|
||||
],
|
||||
'request_uri' => '',
|
||||
]))),
|
||||
])),
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $handler->getHeaders());
|
||||
@@ -115,7 +115,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
$handler2->handle($this->getRecord(Logger::WARNING));
|
||||
|
||||
$expected = [
|
||||
'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode([
|
||||
'X-ChromeLogger-Data' => base64_encode(json_encode([
|
||||
'version' => '4.0',
|
||||
'columns' => ['label', 'log', 'backtrace', 'type'],
|
||||
'rows' => [
|
||||
@@ -125,7 +125,7 @@ class ChromePHPHandlerTest extends TestCase
|
||||
'test',
|
||||
],
|
||||
'request_uri' => '',
|
||||
]))),
|
||||
])),
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $handler2->getHeaders());
|
||||
|
Reference in New Issue
Block a user