Skip to content
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

[Cache] Make sure we get the correct number of values from redis::mget() #34668

Merged
merged 1 commit into from Nov 27, 2019
Merged

Conversation

thePanz
Copy link
Contributor

@thePanz thePanz commented Nov 27, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

Redis might not be reachable when invoking redis->mget($ids), the call returns false instead of an array.
This change makes sure the return value is properly check, including the correctness of the parameters to invoke array_combine($ids, $cacheValues);.
From the documentation:

Returns the combined array, FALSE if the number of elements for each array isn't equal.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM, for 3.4. Just one minor comment.

src/Symfony/Component/Cache/Traits/RedisTrait.php Outdated Show resolved Hide resolved
@nicolas-grekas nicolas-grekas modified the milestones: 4.4, 3.4 Nov 27, 2019
@nicolas-grekas nicolas-grekas changed the title Make sure we get the correct number of values from redis::mget() [Cache] Make sure we get the correct number of values from redis::mget() Nov 27, 2019
@nicolas-grekas nicolas-grekas changed the base branch from 4.4 to 3.4 November 27, 2019 18:56
@nicolas-grekas
Copy link
Member

Thank you @thePanz.

nicolas-grekas added a commit that referenced this pull request Nov 27, 2019
… redis::mget() (thePanz)

This PR was merged into the 3.4 branch.

Discussion
----------

[Cache] Make sure we get the correct number of values from redis::mget()

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Redis might not be reachable when invoking `redis->mget($ids)`, the call returns `false` instead of an array.
This change makes sure the return value is properly check, including the correctness of the parameters to invoke  `array_combine($ids, $cacheValues);`.
From the documentation:
> Returns the combined array, FALSE if the number of elements for each array isn't equal.

Commits
-------

685c36c [Cache] Make sure we get the correct number of values from redis::mget()
@nicolas-grekas nicolas-grekas merged commit 685c36c into symfony:3.4 Nov 27, 2019
@thePanz
Copy link
Contributor Author

thePanz commented Nov 27, 2019

Thank you @nicolas-grekas for merging.
Is this going to be merged to the 4.3 branch too?

@thePanz thePanz deleted the patch-2 branch November 27, 2019 20:19
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.

None yet

3 participants