Closed
Description
Symfony version(s) affected: 5.2
Description
Changed attributes (e.g. for the SerializedName or Groups attributes) are not detected and the config cache is not renewed.
How to reproduce
You get a failing test with this patch:
dif
683A
f --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
index 2bbc95ee61..42a4fc5d22 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
@@ -151,6 +151,10 @@ EOPHP;
yield [0, 9, 'private string $priv;'];
}
+ if (\PHP_VERSION_ID >= 80000) {
+ yield [1, 10, '#[SomeAttribute()]'];
+ }
+
yield [1, 17, 'public function ccc($bar = 187) {}'];
yield [1, 17, 'public function ccc($bar = ANOTHER_ONE_THAT_WILL_NEVER_BE_DEFINED_CCCCCCCCC) {}'];
yield [1, 17, null, static function () { \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }];
Possible Solution
Consider the attributes while building the file hash.
Additional context
It seems like ReflectionMethod::__toString()
does not include information about attributes. I am not sure if this is on purpose of if this is missing. (Also, ReflectionAttribute does not have a __toString()
method like the other reflection classes have).
See https://3v4l.org/Ht9pi
Maybe this needs to be adjusted in PHP as well (not sure about that).