Commit fcbb2a7f authored by Alessandro Chitolina's avatar Alessandro Chitolina

Fixed undefined index notice when attempting to reconnect a...

Fixed undefined index notice when attempting to reconnect a MasterSlaveConnection after close has called
parent a2e87c57
...@@ -290,6 +290,9 @@ class MasterSlaveConnection extends Connection ...@@ -290,6 +290,9 @@ class MasterSlaveConnection extends Connection
unset($this->connections['slave']); unset($this->connections['slave']);
parent::close(); parent::close();
$this->_conn = null;
$this->connections = array('master' => null, 'slave' => null);
} }
/** /**
......
...@@ -126,4 +126,17 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase ...@@ -126,4 +126,17 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$conn->connect('slave'); $conn->connect('slave');
$this->assertFalse($conn->isConnectedToMaster()); $this->assertFalse($conn->isConnectedToMaster());
} }
public function testMasterSlaveConnectionCloseAndReconnect()
{
$conn = $this->createMasterSlaveConnection();
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
$conn->close();
$this->assertFalse($conn->isConnectedToMaster());
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment