mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 21:26:43 +02:00
Fix json encoding, fixes #110
This commit is contained in:
@@ -85,6 +85,6 @@ class LineFormatter extends NormalizerFormatter
|
||||
return json_encode($this->normalize($data), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
return stripslashes(json_encode($this->normalize($data)));
|
||||
return str_replace('\\/', '/', json_encode($this->normalize($data)));
|
||||
}
|
||||
}
|
||||
|
@@ -86,11 +86,8 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')),
|
||||
'message' => 'foobar',
|
||||
));
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
||||
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: {})","baz":[],"res":"[resource]"}'."\n", $message);
|
||||
} else {
|
||||
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\Formatter\\TestFoo: {"foo":"foo"})","bar":"[object] (Monolog\\Formatter\\TestBar: {})","baz":[],"res":"[resource]"}'."\n", $message);
|
||||
}
|
||||
|
||||
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: {})","baz":[],"res":"[resource]"}'."\n", $message);
|
||||
}
|
||||
|
||||
public function testBatchFormat()
|
||||
|
Reference in New Issue
Block a user