Ensure backwards compatible behavior with PHP5

This commit is contained in:
Bryant Luk
2016-01-07 15:18:53 -06:00
parent 3ceebc637d
commit 7f8ebae5e7

View File

@@ -21,6 +21,9 @@ class JsonValidator
{
@json_decode($string);
if (json_last_error() != JSON_ERROR_NONE) {
if ($string === '' || $string === null) {
return true;
}
if ($silent == false) {
//Throw an Exception for string or array
throw new \InvalidArgumentException("Invalid JSON String");