Refixed Old-style pdo connection string
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 5991586..c5940dd 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -116,15 +116,12 @@
// hostname generally would have this prototype
// $db['hostname'] = 'pdodriver:host(/Server(/DSN))=hostname(/DSN);';
// We need to get the prefix (pdodriver used by PDO).
- $this->dsn = $this->hostname;
- $this->pdodriver = current(explode(':', $this->hostname));
+ $dsnarray = explode(':', $this->hostname);
+ $this->pdodriver = $dsnarray[0];
// End dsn with a semicolon for extra backward compability
// if database property was not empty.
- if ( ! empty($this->database))
- {
- $this->dsn .= rtrim($this->dsn, ';').';';
- }
+ $this->dsn .= rtrim($this->hostname, ';').';';
}
else
{
@@ -139,7 +136,9 @@
$this->dsn = $this->pdodriver.':';
// Add hostname to the DSN for databases that need it
- if ( ! empty($this->hostname) && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid')))
+ if ( ! empty($this->hostname)
+ && strpos($this->hostname, ':') === FALSE
+ && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid')))
{
$this->dsn .= 'host='.$this->hostname.';';
}