Skip to content

Commit 5d831f3

Browse files
committed
Fix JsonDecode to work on PHP 5.3, update the CHANGELOG.md
1 parent 9ff8dfd commit 5d831f3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
CHANGELOG
22
=========
33

4+
2.2.0
5+
-----
6+
7+
* All Serializer, Normalizer and Encoder interfaces have been
8+
modified to include an optional ``$context`` array parameter.
9+
* The XML Root name can now be configured with the ``xml_root_name``
10+
parameter in the context option to the ``XmlEncoder``.
11+
* Options to ``json_encode`` and ``json_decode`` can be passed through
12+
the context options of ``JsonEncode`` and ``JsonDecode`` encoder/decoders.
13+
414
2.1.0
515
-----
616

Encoder/JsonDecode.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ public function decode($data, $format, array $context = array())
5757
$recursionDepth = $context['json_decode_recursion_depth'];
5858
$options = $context['json_decode_options'];
5959

60-
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
60+
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
61+
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
62+
} else {
63+
$decodedData = json_decode($data, $associative, $recursionDepth);
64+
}
65+
6166
$this->lastError = json_last_error();
6267

6368
return $decodedData;

0 commit comments

Comments
 (0)