-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Prevent fatal errors on php 8 when running concurrently with TagAwareAdapter v6.1 #46143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
84a0b75
to
22c3afd
Compare
@@ -430,6 +433,10 @@ private function getTagVersions(array $tagsByKey, array &$invalidatedTags = []) | |||
if (isset($invalidatedTags[$tag])) { | |||
$invalidatedTags[$tag] = $version->set(++$tagVersions[$tag]); | |||
} | |||
if (!\is_int($tagVersions[$tag])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the line above, we have a ++
on this entry, shouldn't we check for this earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ operator works with strings
Although it not always changes string values (and thus no invalidation occurs in those cases) but at least it doesn't do the fatality.
Can we add a test to prevent future regressions? |
22c3afd
to
0f085c4
Compare
I've added a few tests. Please let me know if they make sense. |
0f085c4
to
33790b3
Compare
…TagAwareAdapter v6.1
33790b3
to
33f8496
Compare
Thank you @sbelyshkin. |
This fix prevents fatal errors which may arise during rolling updates when TagAwareAdapter is upgraded from versions prior to 5.4 to the latest 6.1. TypeErrors occur because of different value types for tag versions and rules for numeric strings in php 8.x https://www.php.net/manual/en/language.types.numeric-strings.php