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

fix validation of redis context parameters array (#315) #317

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

stklcode
Copy link
Contributor

@stklcode stklcode commented Feb 1, 2025

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

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.
@stklcode stklcode added the bug label Feb 1, 2025
@stklcode stklcode added this to the 2.4.1 milestone Feb 1, 2025
@stklcode stklcode self-assigned this Feb 1, 2025
Copy link

sonarqubecloud bot commented Feb 1, 2025

Copy link
Contributor

@lloc lloc left a comment

Choose a reason for hiding this comment

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

That seems OK to me. I guess this becomes more and more complex. I will do a PR and bring PHPStan in. ;-)

@stklcode stklcode merged commit 2b8a899 into develop Feb 10, 2025
15 checks passed
@stklcode stklcode deleted the fix/315-redis-validation branch February 10, 2025 17:58
@stklcode
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Valdation of Redis servers rejects auth parameter
2 participants