Util/Json: Support PHP 5.3
This commit is contained in:
parent
3d3b1cdf4f
commit
b86789ecc5
|
@ -43,7 +43,12 @@ class Json
|
|||
*/
|
||||
public static function decode($json, $assoc = false, $depth = 512, $options = 0)
|
||||
{
|
||||
$decoded = json_decode($json, $assoc, $depth, $options);
|
||||
if (version_compare(phpversion(), '5.4.0', '<')) {
|
||||
$decoded = json_decode($json, $assoc, $depth);
|
||||
} else {
|
||||
$decoded = json_decode($json, $assoc, $depth, $options);
|
||||
}
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new JsonDecodeException('%s: %s', static::lastErrorMsg(), var_export($json, true));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue