-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Cache][FrameworkBundle] Fix logging for TagAwareAdapter #40740
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
fancyweb
commented
Apr 8, 2021
| Q | A |
|---|---|
| Branch? | 4.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | #40108 |
| License | MIT |
| Doc PR | - |
cccd9d1 to
22de60a
Compare
|
Do we want to bump the required minimum symfony/cache version in FWB for this or add a runtime check? |
|
Hey! I think @v-m-i has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
v-m-i
left a comment
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.
Hi @fancyweb, thank you for this PR.
Kudos for detailed and readable tests.
I have added one typo-fix suggestion. Everything else looks good :)
Besides code, I see that some builds have failed so I would suggest looking into that.
src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
Outdated
Show resolved
Hide resolved
nicolas-grekas
left a comment
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.
(once the typo is fixed)
c08849f to
beb338b
Compare
beb338b to
6b0beca
Compare
| public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata = null, LoggerInterface $logger = null) | ||
| { | ||
| $key = self::$files ? crc32($item->getKey()) % \count(self::$files) : -1; | ||
| $key = self::$files ? abs(crc32($item->getKey())) % \count(self::$files) : -1; |
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.
Because PHP's integer type is signed many crc32 checksums will result in negative integers on 32bit platforms.
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.
I find it better to use sprintf('%u')
|
Tests are green 🎉 |
|
Thank you @fancyweb. |
…yweb) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Fix log channel of TagAwareAdapter | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Forgot to add the tag in #40740, therefore the "app" logger is injected instead of the "cache" one. Commits ------- 494ceaf [FrameworkBundle] Fix log channel of TagAwareAdapter
…yweb) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Fix log channel of TagAwareAdapter | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Forgot to add the tag in symfony/symfony#40740, therefore the "app" logger is injected instead of the "cache" one. Commits ------- 494ceaf6cc [FrameworkBundle] Fix log channel of TagAwareAdapter