8000 Clear json_last_error · symfony/symfony@6d6a3af · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d6a3af

Browse files
GromNaNfabpot
authored andcommitted
Clear json_last_error
1 parent ef91f71 commit 6d6a3af

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Symfony/Component/HttpFoundation/JsonResponse.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ public function setData($data = array())
107107
});
108108

109109
try {
110+
// Clear json_last_error()
111+
json_encode(null);
112+
110113
$this->data = json_encode($data, $this->encodingOptions);
111114

112115
restore_error_handler();

src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ public function testSetContent()
203203
}
204204

205205
/**
206-
* @expectedException PHPUnit_Framework_Error_Warning
207-
* @expectedExceptionMessage This error is expected
206+
* @expectedException Exception
207+
* @expectedExceptionMessage Failed calling Symfony\Component\HttpFoundation\Tests\JsonSerializableObject::jsonSerialize()
208+
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php#114688
208209
*/
209210
public function testSetContentJsonSerializeError()
210211
{

0 commit comments

Comments
 (0)
0