diff --git a/src/ValidationChain.php b/src/ValidationChain.php index 75e74a6..610459b 100644 --- a/src/ValidationChain.php +++ b/src/ValidationChain.php @@ -216,7 +216,7 @@ class ValidationChain private array $error = []; private array $errorArgs = []; - /** + /** * Constructor for the ValidationChain class. * * @param mixed $value The initial value to be validated. @@ -440,4 +440,5 @@ public function validate(?string $description = null): void { $this->describe($description); } + } diff --git a/src/Validator.php b/src/Validator.php index 48045b3..cb9affa 100755 --- a/src/Validator.php +++ b/src/Validator.php @@ -567,6 +567,9 @@ public function isResource(): bool */ public function isJson(): bool { + if(!is_string($this->value) && !is_numeric($this->value)) { + return false; + } json_decode($this->value); return json_last_error() === JSON_ERROR_NONE; }