Skip to content

Commit 6c3eb98

Browse files
committed
a bug fixed
1 parent 1ca9c12 commit 6c3eb98

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ValidatorList.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,14 @@ public static function json($val, $strict = true)
654654
return false;
655655
}
656656

657+
$val = (string)$val;
658+
657659
// must start with: { OR [
658660
if ($strict && '[' !== $val[0] && '{' !== $val[0]) {
659661
return false;
660662
}
661663

662-
json_decode((string)$val);
664+
json_decode($val);
663665

664666
return json_last_error() === JSON_ERROR_NONE;
665667
}

0 commit comments

Comments
 (0)