8000 [Cache] Add type to redis scan call to avoid using default "" which r… by mfadul24 · Pull Request #51838 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Cache] Add type to redis scan call to avoid using default "" which r… #51838

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

Closed
wants to merge 1 commit into from

Conversation

mfadul24
Copy link
@mfadul24 mfadul24 commented Oct 4, 2023
Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
License MIT

The cache:pool:clear command is not clearing the existing redis keys correctly. The method is being call without a valid type, which gets a empty array as response.

The redis MONITOR command shows the following type of call:
"SCAN" "0" "COUNT" "1000" "MATCH" "<prefix>:*" "TYPE" ""

Correct would be to set the TYPE to string.
"SCAN" "0" "COUNT" "1000" "MATCH" "<prefix>:*" "TYPE" "string"

See Documentation: https://redis.io/commands/type/

This PullRequest also fix the deprecation:
Deprecated: Redis::scan(): Passing null to parameter #4 ($type) of type ?string is deprecated {"exception":"[object] (ErrorException(code: 0): Deprecated: Redis::scan(): Passing null to parameter #4 ($type) of type ?string is deprecated at /var/www/vendor/symfony/cache/Traits/Redis6Proxy.php:893)"

@OskarStark
Copy link
Contributor
OskarStark commented Oct 6, 2023

I removed the deprecations label, as this does not introduce a new deprecation, but fixes one.

Are you sure, this bug does not exist in 5.4?

@fabpot
Copy link
Member
fabpot commented Oct 7, 2023

The code looks the same on 5.4.
Can you add a test as well?

@mfadul24
Copy link
Author
mfadul24 commented Oct 9, 2023

Hi, I've update the PR to use the 5.4 branch and add a test for this use case. I hope it looks good enough for you. Look forward to my first contribution.

@mfadul24 mfadul24 changed the base branch from 6.3 to 5.4 October 9, 2023 20:40
@nicolas-grekas
Copy link
Member

Thanks for giving this a try. I'm closing in favor of #52036, which provides a more generic fix to such issues. This should still be fixed in phpredis, but at least we won't fall into the trap.

nicolas-grekas added a commit that referenced this pull request Oct 13, 2023
…y behaviors of internal classes (nicolas-grekas)

This PR was merged into the 6.3 branch.

Discussion
----------

[Cache][VarExporter] Fix proxy generation to deal with edgy behaviors of internal classes

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #51770, #51679, #51700
| License       | MIT

Instead of #51838

This fixes the issue by not passing default values explicitly when they were not provided during the call to the method.

Commits
-------

c66a2f7 [Cache][VarExporter] Fix proxy generation to deal with edgy behaviors of internal classes
@mfadul24 mfadul24 deleted the fixClearCachePool branch October 17, 2023 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0