Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Config] Cached attribute changes are not detected #39988

Copy link
Copy link
Closed
@digilist

Description

@digilist
Issue body actions

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:

diff --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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.