Skip to content

[Lock] Fix predis command error checking #59348

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

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

dciprian-petrisor
Copy link
Contributor

Q A
Branch? 7.2
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #59087
License MIT

We seem to have had an incompatibility with how Predis clients are initialized ('exceptions' => false) and the implementation of RedisStore, which only surfaced now due to the recent EVAL -> EVALSHA changes.

According to https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Cache/Traits/RedisTrait.php#L65 and
https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Cache/Traits/RedisTrait.php#L419 , the Predis client is always initialized with exceptions disabled; it returns Error objects instead.

This PR fixes the tests to replicate this behaviour and the implementation.

An small additional change was made regarding error checking, to ensure the initial evalSha does not fail with anything else besides the expected NOSCRIPT error.

@dciprian-petrisor dciprian-petrisor force-pushed the predis-lock-evalsha-bugfix branch from 9b0ae19 to 4816402 Compare January 2, 2025 19:10
@fabpot
Copy link
Member

fabpot commented Jan 4, 2025

Thank you @dciprian-petrisor.

@fabpot fabpot merged commit b048d76 into symfony:7.2 Jan 4, 2025
11 checks passed
@fabpot fabpot mentioned this pull request Jan 29, 2025
nicolas-grekas added a commit that referenced this pull request Feb 4, 2025
This PR was merged into the 7.2 branch.

Discussion
----------

[Lock] Fix Predis error handling

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #59686
| License       | MIT

#59348 completely broke the Redis store when used with a service, eg:

```yaml
framework:
  lock:
    resources:
      default: snc_redis.default
```

The assumption that `exceptions` is always `false` is only correct when a DSN is used.

Commits
-------

b20892f [Lock] Fix Predis error handling
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.

4 participants