Ticket Details
Inverted logic + missing checks in MySQL::connect()
BUG Ticket (closed)
###What happened: - something config checks for persistent connection and uses non-persistent if the latter is set to true ###What was expected: - something else MySQL should use a persistent connection if configured as so
{{{ diff --git a/libraries/lithium/data/source/database/adapter/MySql.php b/libraries/lithiu index 5d0b4ad..8a8c938 100644 --- a/libraries/lithium/data/source/database/adapter/MySql.php +++ b/libraries/lithium/data/source/database/adapter/MySql.php @@ -116,14 +116,20 @@ class MySql extends \lithium\data\source\Database { return false; } - if ($config['persistent']) { + if (!$config['persistent']) { $this->connection = mysql_connect($host, $config['login'], $conf } else { $this->connection = mysql_pconnect($host, $config['login'], $con } + + if (!$this->connection) { + return false; + } if (mysql_select_db($config['database'], $this->connection)) { $this->_isConnected = true; + } else { + return false; } if ($config['encoding']) { }}}