Fix JsonDecode to work on PHP 5.3, update the CHANGELOG.md
This commit is contained in:
parent
b6bdb450e3
commit
fcabadfc23
|
@ -1,6 +1,16 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
2.2.0
|
||||
-----
|
||||
|
||||
* All Serializer, Normalizer and Encoder interfaces have been
|
||||
modified to include an optional ``$context`` array parameter.
|
||||
* The XML Root name can now be configured with the ``xml_root_name``
|
||||
parameter in the context option to the ``XmlEncoder``.
|
||||
* Options to ``json_encode`` and ``json_decode`` can be passed through
|
||||
the context options of ``JsonEncode`` and ``JsonDecode`` encoder/decoders.
|
||||
|
||||
2.1.0
|
||||
-----
|
||||
|
||||
|
|
|
@ -57,7 +57,12 @@ class JsonDecode implements DecoderInterface
|
|||
$recursionDepth = $context['json_decode_recursion_depth'];
|
||||
$options = $context['json_decode_options'];
|
||||
|
||||
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
|
||||
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
||||
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
|
||||
} else {
|
||||
$decodedData = json_decode($data, $associative, $recursionDepth);
|
||||
}
|
||||
|
||||
$this->lastError = json_last_error();
|
||||
|
||||
return $decodedData;
|
||||
|
|
Reference in New Issue