summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-05-27 14:57:22 +0200
committerJulius Härtl <jus@bitgrid.net>2022-05-30 19:17:49 +0200
commit3901a93c72ed7a008902a79fb5e0ee1de018f7bd (patch)
tree3c7c52f9bf19596028c5c25f3caf9ce33794dfcc /lib/public
parent7140201a322d5be30e899143a0482aaba05b7ade (diff)
downloadnextcloud-server-3901a93c72ed7a008902a79fb5e0ee1de018f7bd.tar.gz
nextcloud-server-3901a93c72ed7a008902a79fb5e0ee1de018f7bd.zip
Use JSON_THROW_ON_ERROR instead of custom error handling
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/Http/JSONResponse.php8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php
index f4b936435c8..4870a64afd7 100644
--- a/lib/public/AppFramework/Http/JSONResponse.php
+++ b/lib/public/AppFramework/Http/JSONResponse.php
@@ -64,13 +64,7 @@ class JSONResponse extends Response {
* @throws \Exception If data could not get encoded
*/
public function render() {
- $response = json_encode($this->data, JSON_HEX_TAG);
- if ($response === false) {
- throw new \Exception(sprintf('Could not json_encode due to invalid ' .
- 'non UTF-8 characters in the array: %s', var_export($this->data, true)));
- }
-
- return $response;
+ return json_encode($this->data, JSON_HEX_TAG | JSON_THROW_ON_ERROR);
}
/**