mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
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)
|
public static function decode($json, $assoc = false, $depth = 512, $options = 0)
|
||||||
{
|
{
|
||||||
|
if (version_compare(phpversion(), '5.4.0', '<')) {
|
||||||
|
$decoded = json_decode($json, $assoc, $depth);
|
||||||
|
} else {
|
||||||
$decoded = json_decode($json, $assoc, $depth, $options);
|
$decoded = json_decode($json, $assoc, $depth, $options);
|
||||||
|
}
|
||||||
|
|
||||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
throw new JsonDecodeException('%s: %s', static::lastErrorMsg(), var_export($json, true));
|
throw new JsonDecodeException('%s: %s', static::lastErrorMsg(), var_export($json, true));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user