Skip to content

Commit 548fd6a

Browse files
committed
fixed regression from #37
reconnecting a closed connection fails. fixes #67
1 parent 5a0bb55 commit 548fd6a

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Yii Framework 2 redis extension Change Log
44
2.0.6 under development
55
-----------------------
66

7+
- Bug #67: Fixed regression from 2.0.5, reconnecting a closed connection fails (cebe)
78
- Enh: Optimized find by PK for relational queries and IN condition (cebe, andruha)
89

910

Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public function close()
306306
\Yii::trace('Closing DB connection: ' . $connection, __METHOD__);
307307
$this->executeCommand('QUIT');
308308
stream_socket_shutdown($this->_socket, STREAM_SHUT_RDWR);
309-
$this->_socket = null;
309+
$this->_socket = false;
310310
}
311311
}
312312

tests/RedisConnectionTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ public function testConnect()
3232
$db->close();
3333
}
3434

35+
/**
36+
* tests whether close cleans up correctly so that a new connect works
37+
*/
38+
public function testReConnect()
39+
{
40+
$db = $this->getConnection(false);
41+
$db->open();
42+
$this->assertTrue($db->ping());
43+
$db->close();
44+
45+
$db->open();
46+
$this->assertTrue($db->ping());
47+
$db->close();
48+
}
49+
50+
3551
public function keyValueData()
3652
{
3753
return [

0 commit comments

Comments
 (0)