Skip to content

Commit 2ec0b75

Browse files
Mirocowsamdark
authored andcommitted
Fixes #37: Fixed detection of open socket
1 parent c5b33d1 commit 2ec0b75

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Yii Framework 2 redis extension Change Log
44
2.0.5 under development
55
-----------------------
66

7+
- Bug #37: Fixed detection of open socket (mirocow)
78
- Chg #14: Added missing `BLPOP` to `$redisCommands` (samdark)
89

9-
1010
2.0.4 May 10, 2015
1111
------------------
1212

Connection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class Connection extends Component
225225
/**
226226
* @var resource redis socket connection
227227
*/
228-
private $_socket;
228+
private $_socket = false;
229229

230230

231231
/**
@@ -245,7 +245,7 @@ public function __sleep()
245245
*/
246246
public function getIsActive()
247247
{
248-
return $this->_socket !== null;
248+
return $this->_socket !== false;
249249
}
250250

251251
/**
@@ -255,7 +255,7 @@ public function getIsActive()
255255
*/
256256
public function open()
257257
{
258-
if ($this->_socket !== null) {
258+
if ($this->_socket !== false) {
259259
return;
260260
}
261261
$connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database;
@@ -288,7 +288,7 @@ public function open()
288288
*/
289289
public function close()
290290
{
291-
if ($this->_socket !== null) {
291+
if ($this->_socket !== false) {
292292
$connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database;
293293
\Yii::trace('Closing DB connection: ' . $connection, __METHOD__);
294294
$this->executeCommand('QUIT');

0 commit comments

Comments
 (0)