Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[Cache] Fixed incorrect usage of UNLINK with PHPRedis with Redis < 4.0#39298

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.2fromcolinpieper:ticket_39280
Dec 8, 2020

Conversation

@colinpieper
Copy link

@colinpiepercolinpieper commentedDec 3, 2020
edited
Loading

QA
Branch?5.2
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#39280
LicenseMIT

Currently, deleting cache keys is broken for users using PhpRedis with Redis-server < 4.0.0. The current implementation expects PhpRedis to throw an exception if the 'unlink'-function is used but unavailable, after which it's supposed to switch to using the 'del'-function. Using the 'unlink'-function on lower Redis-server versions seems to not throw an exception, but instead it appears to silently fail.

This pull request changes this behavior and checks the Redis-server version instead. If the version is 4.0 or higher, it uses the unlink function. If not, it uses the del-function.

Also seehttps://redis.io/commands/unlink > "Available since 4.0.0".

(Footnote: this is one of my first times contributing to an open-source project and my first time contributing to Symfony. I've tried following the guidelines, but please let me know if I missed anything. I'm unsure how I would go about unit testing this specific bugfix due to it being dependent on the Redis version, so I omitted it. Please let me know if a unit test is indeed required for this and if so, let me know if you have any suggestions on how to go about that.)

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.x branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@derrabus
Copy link
Member

Thank you very much for working on this issue. Because the 5.2 branch is affected by this bug, please base your PR on the 5.2 branch.

@derrabusderrabus added this to the5.2 milestoneDec 3, 2020
@colinpiepercolinpieper changed the base branch from5.x to5.2December 3, 2020 13:37
Copy link
Member

@jderussejderusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

From the Redis documentation this is available since Redis 4.0https://redis.io/commands/unlink

I believe the fix should also be applied to Predis. Right?

Looks like thePredis\Command\Redis\UNLINK does not exists. /cc@jonashrem

@colinpieper
Copy link
Author

colinpieper commentedDec 4, 2020
edited
Loading

Here's the pull request that introduced these changes:#37993.

The UNLINK command is a pending pull request to Predis (seepredis/predis#666) and not yet available, but might be in the future if/when it's approved. There's a check to see if that class exists or it will fall back to the DELETE-command, so there currently aren't any negative side effects in keeping it as far as I can see.

These changes will also need to be applied to the following two files:

  • src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php
  • src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

I'll implement those corrections soon.

jderusse and derrabus reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

Which version of phpredis are you using?
On my machine, using v5.3.2, I do get an exception.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looking at@jderusse's comment at#39280 (comment), we should handle the case where the call returnsfalse instead.

@nicolas-grekas
Copy link
Member

Thank you@Wickex.

@nicolas-grekasnicolas-grekas merged commit5f08c61 intosymfony:5.2Dec 8, 2020
@fabpotfabpot mentioned this pull requestDec 18, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse left review comments

@derrabusderrabusderrabus left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas requested changes

@srozesrozeAwaiting requested review from sroze

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

RedisCache delete/clear not working anymore

6 participants

@colinpieper@carsonbot@derrabus@nicolas-grekas@jderusse@Wickex

[8]ページ先頭

©2009-2025 Movatter.jp