Skip to content

Commit 320d5cb

Browse files
author
dcb9
committed
Merge branch 'arieslee-master' into fixTravisCI
2 parents 995b789 + 2f9fe05 commit 320d5cb

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Connection.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,29 @@ public static function className()
7777
* Establishes a DB connection.
7878
* It does nothing if a DB connection has already been established.
7979
* @throws RedisException if connection fails
80+
* @example 问题详细描述 https://bugs.php.net/bug.php?id=46851 php_redis.so 版本为4.0.2时会出现一条警告
81+
* @see connect()
82+
* @param string $host
83+
* @param int $port
84+
* @param float $timeout
85+
* @param int $retry_interval
86+
* @return bool
8087
*/
81-
public function open()
88+
public function open( $host = null, $port = null, $timeout = null, $retry_interval = 0 )
8289
{
8390
if ($this->unixSocket !== null) {
8491
$isConnected = $this->connect($this->unixSocket);
8592
} else {
86-
$isConnected = $this->connect($this->hostname, $this->port, $this->connectionTimeout);
93+
if(is_null($host)){
94+
$host = $this->hostname;
95+
}
96+
if(is_null($port)){
97+
$port = $this->port;
98+
}
99+
if(is_null($timeout)){
100+
$timeout = $this->connectionTimeout;
101+
}
102+
$isConnected = $this->connect($host, $port, $timeout, null, $retry_interval);
87103
}
88104

89105
if ($isConnected === false) {

0 commit comments

Comments
 (0)