Skip to content

Commit

Permalink
Add comment explaining patch
Browse files Browse the repository at this point in the history
  • Loading branch information
adlawson committed Feb 16, 2016
1 parent 9666d15 commit c943f3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON',
JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded',
];

// Patched support for decoding empty strings for PHP 7+
$data = \json_decode($json == "" ? "{}" : $json, $assoc, $depth, $options);

if (JSON_ERROR_NONE !== json_last_error()) {
Expand Down

0 comments on commit c943f3e

Please sign in to comment.