Skip to content

Conversation

@luizmanhani
Copy link
Contributor

@luizmanhani luizmanhani commented Oct 7, 2025

fix a issue that you cannot use context config without set auth config.

The isset ignore null config causing the creation of RedisCluster with context config as auth, creating problems like configure TLS config like the redis extension documentation says:

// Connect with cluster using TLS
// last argument is an optional array with [SSL context options](https://www.php.net/manual/en/context.ssl.php) (TLS options)
// If value is array (even empty), it will connect via TLS.  If not, it will connect without TLS.
// Note: If the seeds start with "ssl:// or tls://", it will connect to the seeds via TLS, but the subsequent connections will connect without TLS if this value is null.  So, if your nodes require TLS, this value must be an array, even if empty.
$obj_cluster = new RedisCluster(NULL, ["host:7000", "host:7001"], 1.5, 1.5, true, NULL, ["verify_peer" => false]);

https://github.com/phpredis/phpredis/blob/develop/cluster.md#creating-and-connecting-to-a-cluster

@luizmanhani luizmanhani changed the title Fix/redis cluster config order Fixed bug that the parameter context on redis cluster cannot work when auth config isn't set or set with null value. Oct 7, 2025
leocavalcante
leocavalcante previously approved these changes Oct 7, 2025
leocavalcante
leocavalcante previously approved these changes Oct 7, 2025
@huangdijia huangdijia requested a review from Copilot October 8, 2025 00:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where Redis cluster connections with TLS context configuration would fail when authentication is not configured or set to null. The issue prevented proper TLS setup as documented in the phpredis extension.

  • Replaced conditional auth parameter addition with null coalescing operator
  • Ensures consistent parameter ordering for RedisCluster constructor calls
  • Enables proper TLS context configuration without requiring auth credentials

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

huangdijia
huangdijia previously approved these changes Oct 8, 2025
@limingxinleo limingxinleo dismissed stale reviews from huangdijia and leocavalcante via d1fab97 October 28, 2025 12:56
@limingxinleo limingxinleo merged commit 007f67b into hyperf:master Oct 28, 2025
74 checks passed
@limingxinleo limingxinleo mentioned this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants