Skip to content

Commit b5cbbb6

Browse files
committed
Assume that json_decode always exists
Signed-off-by: Mathias Berchtold <[email protected]>
1 parent e4abef2 commit b5cbbb6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Controller/AbstractRestfulController.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use function call_user_func;
1919
use function count;
2020
use function explode;
21-
use function function_exists;
2221
use function get_debug_type;
2322
use function is_array;
2423
use function is_callable;
@@ -601,22 +600,15 @@ protected function processBodyContent(mixed $request)
601600
/**
602601
* Decode a JSON string.
603602
*
604-
* Uses json_decode by default. If that is not available, raises an exception.
603+
* Uses json_decode by default.
605604
*
606605
* Marked protected to allow usage from extending classes.
607606
*
608607
* @param string $string
609608
* @return mixed
610-
* @throws Exception\DomainException If no JSON decoding functionality is available.
611609
*/
612610
protected function jsonDecode($string)
613611
{
614-
if (function_exists('json_decode')) {
615-
return json_decode($string, (bool) $this->jsonDecodeType);
616-
}
617-
618-
throw new DomainException(
619-
'Unable to parse JSON request, due to missing ext/json'
620-
);
612+
return json_decode($string, (bool) $this->jsonDecodeType);
621613
}
622614
}

0 commit comments

Comments
 (0)