From 69864aeb13c53b375b59ecc18f1294e4ac7047de Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 16 Apr 2012 11:13:34 +0200 Subject: [PATCH] Make check more explicit --- src/Composer/Json/JsonFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index c4d9ef59c..695679d1d 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -271,7 +271,7 @@ class JsonFile public static function parseJson($json) { $data = json_decode($json, true); - if (null === $data && json_last_error()) { + if (null === $data && JSON_ERROR_NONE !== json_last_error()) { self::validateSyntax($json); } @@ -290,7 +290,7 @@ class JsonFile $parser = new JsonParser(); $result = $parser->lint($json); if (null === $result) { - if (defined('JSON_ERROR_UTF8') && json_last_error() === JSON_ERROR_UTF8) { + if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) { throw new \UnexpectedValueException('JSON file is not UTF-8 encoded'); }