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

Add JSON_PARTIAL_OUTPUT_ON_ERROR, closes #1515

This commit is contained in:
Jordi Boggiano
2020-12-10 16:22:14 +01:00
parent d356586239
commit 9ce0431191
2 changed files with 5 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ namespace Monolog;
final class Utils final class Utils
{ {
const DEFAULT_JSON_FLAGS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_INVALID_UTF8_SUBSTITUTE; const DEFAULT_JSON_FLAGS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_INVALID_UTF8_SUBSTITUTE | JSON_PARTIAL_OUTPUT_ON_ERROR;
public static function getClass(object $object): string public static function getClass(object $object): string
{ {

View File

@@ -208,11 +208,7 @@ class NormalizerFormatterTest extends TestCase
restore_error_handler(); restore_error_handler();
if (PHP_VERSION_ID < 50500) { $this->assertEquals('[{"bar":{"foo":null}},{"foo":{"bar":null}}]', $res);
$this->assertEquals('[{"bar":{"foo":null}},{"foo":{"bar":null}}]', $res);
} else {
$this->assertEquals('null', $res);
}
} }
public function testCanNormalizeReferences() public function testCanNormalizeReferences()
@@ -224,9 +220,9 @@ class NormalizerFormatterTest extends TestCase
$formatter->format($y); $formatter->format($y);
} }
public function testIgnoresInvalidTypes() public function testToJsonIgnoresInvalidTypes()
{ {
// set up the recursion // set up the invalid data
$resource = fopen(__FILE__, 'r'); $resource = fopen(__FILE__, 'r');
// set an error handler to assert that the error is not raised anymore // set an error handler to assert that the error is not raised anymore
@@ -247,11 +243,7 @@ class NormalizerFormatterTest extends TestCase
restore_error_handler(); restore_error_handler();
if (PHP_VERSION_ID < 50500) { $this->assertEquals('[null]', $res);
$this->assertEquals('[null]', $res);
} else {
$this->assertEquals('null', $res);
}
} }
public function testNormalizeHandleLargeArraysWithExactly1000Items() public function testNormalizeHandleLargeArraysWithExactly1000Items()