Skip to content

Commit c00da06

Browse files
Seldaeknicolas-grekas
authored andcommitted
[Validator] Avoid triggering the autoloader for user-input values
1 parent 3d762fd commit c00da06

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Validator/RecursiveContextualValidator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,10 @@ private function validateGenericNode($value, $object, ?string $cacheKey, ?Metada
656656
return;
657657
}
658658

659-
// If the value is a scalar, pass it anyway, because we want
660-
// a NoSuchMetadataException to be thrown in that case
659+
if (!\is_object($value)) {
660+
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value)));
661+
}
662+
661663
$this->validateObject(
662664
$value,
663665
$propertyPath,

0 commit comments

Comments
 (0)