[Validator] Avoid triggering the autoloader for user-input values

This commit is contained in:
Jordi Boggiano 2021-03-18 08:44:57 +01:00 committed by Nicolas Grekas
parent 6a6274ca89
commit e45eb23ba2

View File

@ -656,8 +656,10 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
return;
}
// If the value is a scalar, pass it anyway, because we want
// a NoSuchMetadataException to be thrown in that case
if (!\is_object($value)) {
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value)));
}
$this->validateObject(
$value,
$propertyPath,