1
0
Fork 0

json_decode returns null on error, not false

pull/48/head
Jordi Boggiano 2011-10-02 21:04:37 +02:00
parent 9210500714
commit cad0967788
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class JsonFile
{ {
$data = json_decode($json, true); $data = json_decode($json, true);
if (false === $data && 'false' !== $json) { if (null === $data && 'null' !== strtolower($json)) {
switch (json_last_error()) { switch (json_last_error()) {
case JSON_ERROR_NONE: case JSON_ERROR_NONE:
$msg = 'No error has occurred, is your composer.json file empty?'; $msg = 'No error has occurred, is your composer.json file empty?';