This commit is contained in:
2023-10-08 17:55:11 +08:00
parent 8f680d5368
commit f194684d4b
+1 -1
View File
@@ -63,7 +63,7 @@ class TypesOfValidator extends BaseValidator
*/ */
public function jsonFormat($field, $value): bool public function jsonFormat($field, $value): bool
{ {
if (is_null(json_decode($value))) { if (!is_string($value) || is_null(json_decode($value))) {
return $this->addError($field, 'The ' . $field . ' not is JSON data.'); return $this->addError($field, 'The ' . $field . ' not is JSON data.');
} }
return true; return true;