1
0
Fork 0

Make parseJson safer

pull/3827/head
Hugo Fonseca 2015-03-07 19:01:54 +00:00
parent b80038804f
commit e79d067690
1 changed files with 3 additions and 0 deletions

View File

@ -253,6 +253,9 @@ class JsonFile
*/ */
public static function parseJson($json, $file = null) public static function parseJson($json, $file = null)
{ {
if (null === $json) {
return;
}
$data = json_decode($json, true); $data = json_decode($json, true);
if (null === $data && JSON_ERROR_NONE !== json_last_error()) { if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
self::validateSyntax($json, $file); self::validateSyntax($json, $file);