Skip to content

Commit b9bcdce

Browse files
committed
Use JSON_THROW_ON_ERROR instead of custom error handling
Signed-off-by: Julius Härtl <[email protected]>
1 parent 45a75c6 commit b9bcdce

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/public/AppFramework/Http/JSONResponse.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,7 @@ public function __construct($data = [], $statusCode = Http::STATUS_OK) {
6464
* @throws \Exception If data could not get encoded
6565
*/
6666
public function render() {
67-
$response = json_encode($this->data, JSON_HEX_TAG);
68-
if ($response === false) {
69-
throw new \Exception(sprintf('Could not json_encode due to invalid ' .
70-
'non UTF-8 characters in the array: %s', var_export($this->data, true)));
71-
}
72-
73-
return $response;
67+
return json_encode($this->data, JSON_HEX_TAG | JSON_THROW_ON_ERROR);
7468
}
7569

7670
/**

0 commit comments

Comments
 (0)