mirror of
https://github.com/predis/predis.git
synced 2026-10-05 03:17:54 +00:00
Implement full support for IPv6.
Using IPv6 with Predis was basically impossible due to various inconsistencies and bugs through the library, now it is supported by all the connection classes. Following the standard for IPv6 literal addresses in URI strings, the IP literal must be enclosed within square brackets when passing the parameters as a string: $parameters = 'tcp://[2001:db8:0:f101::1]:6379'; See https://tools.ietf.org/html/rfc3986#section-3.2.2 for further details. This commit also fixes #239 making redis-cluster usable with nodes using IPv6.
This commit is contained in:
@@ -74,7 +74,7 @@ class StreamConnection extends AbstractConnection
|
||||
*/
|
||||
protected function tcpStreamInitializer(ParametersInterface $parameters)
|
||||
{
|
||||
$uri = "tcp://{$parameters->host}:{$parameters->port}";
|
||||
$uri = "tcp://[$parameters->host]:$parameters->port";
|
||||
$flags = STREAM_CLIENT_CONNECT;
|
||||
|
||||
if (isset($parameters->async_connect) && (bool) $parameters->async_connect) {
|
||||
|
||||
Reference in New Issue
Block a user