fix validation of redis context parameters array (#315)#317
Merged
Conversation
|
lloc
reviewed
Feb 10, 2025
Contributor
lloc
left a comment
There was a problem hiding this comment.
That seems OK to me. I guess this becomes more and more complex. I will do a PR and bring PHPStan in. ;-)
Contributor
Author
|
Yes, this validation is not very pretty. And spoiler alert: it becomes even more of a mess if we want to extend it to accept PHPRedis 6 syntax [
'host' => '127.0.0.1',
'port' => 6379,
'connectTimeout' => 2.5,
'auth' => ['phpredis', 'phpredis'],
'ssl' => ['verify_peer' => false],
'backoff' => [
'algorithm' => Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER,
'base' => 500,
'cap' => 750,
],
]We should probably think about dropping the deep sanitization, advanced Redis config is a "pro-feature" anyway. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The optional 7th argument the Redis::connect() holds an array of context parameters, required for authentication. This parameter can either be NULL or an array.
Fix the condition, so it does not reject arrays.
resolves #315