From 2d2022cc11968065787aced6108d0e6f37642d4d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 10 Oct 2017 15:22:55 +0200 Subject: [PATCH] fix PHP 7.2 compatibility * the `phpdocumentor/type-resolver` package was not PHP 7.2 compatible before release 0.2.1 (see see phpDocumentor/TypeResolver@e224fb2) * the validator must not call `get_class()` if no object but a class name was passed to the `validatePropertyValue()` method --- composer.json | 2 +- src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- src/Symfony/Component/PropertyInfo/composer.json | 2 +- src/Symfony/Component/Serializer/composer.json | 1 + .../Validator/Validator/RecursiveContextualValidator.php | 4 +++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index d55f29f6aa..f27e19e242 100644 --- a/composer.json +++ b/composer.json @@ -103,7 +103,7 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2", - "phpdocumentor/type-resolver": "<0.2.0", + "phpdocumentor/type-resolver": "<0.2.1", "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "provide": { diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index cdf6e4d2b8..f4ebfe5104 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -61,7 +61,7 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0", - "phpdocumentor/type-resolver": "<0.2.0", + "phpdocumentor/type-resolver": "<0.2.1", "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", "symfony/asset": "<3.3", "symfony/console": "<3.3", diff --git a/src/Symfony/Component/PropertyInfo/composer.json b/src/Symfony/Component/PropertyInfo/composer.json index d068a5ff6a..f9e029e504 100644 --- a/src/Symfony/Component/PropertyInfo/composer.json +++ b/src/Symfony/Component/PropertyInfo/composer.json @@ -35,7 +35,7 @@ }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2", - "phpdocumentor/type-resolver": "<0.2.0", + "phpdocumentor/type-resolver": "<0.2.1", "symfony/dependency-injection": "<3.3" }, "suggest": { diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index e4ee63a730..e1d6ded4aa 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -31,6 +31,7 @@ "phpdocumentor/reflection-docblock": "^3.0|^4.0" }, "conflict": { + "phpdocumentor/type-resolver": "<0.2.1", "symfony/dependency-injection": "<3.2", "symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4", "symfony/property-info": "<3.1", diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index 838d12b403..3b55ab3db1 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -261,11 +261,13 @@ class RecursiveContextualValidator implements ContextualValidatorInterface if (is_object($objectOrClass)) { $object = $objectOrClass; + $class = get_class($object); $cacheKey = spl_object_hash($objectOrClass); $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); } else { // $objectOrClass contains a class name $object = null; + $class = $objectOrClass; $cacheKey = null; $propertyPath = $this->defaultPropertyPath; } @@ -280,7 +282,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface $this->validateGenericNode( $value, $object, - $cacheKey.':'.get_class($object).':'.$propertyName, + $cacheKey.':'.$class.':'.$propertyName, $propertyMetadata, $propertyPath, $groups,