summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-02-13 19:54:55 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-02-13 19:54:55 +0100
commita879147d8e117d4a87aeab79eb0347fb7ae13c76 (patch)
tree549053ce88727bf78fa1e591cf10c884148d7320
parentde7da338e21885b9ecc4f5a64ba77ee8475960d2 (diff)
parent5dcdbc30649d8f8320953f3eb728a3eb5a7f7765 (diff)
Merge pull request #1034 from toopay/pdo_old_hostname
Fixed rtrim issue in hostname fragment, for backward compability
-rw-r--r--system/database/drivers/pdo/pdo_driver.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index e84c1aaaf..5991586c7 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -117,11 +117,14 @@ class CI_DB_pdo_driver extends CI_DB {
// $db['hostname'] = 'pdodriver:host(/Server(/DSN))=hostname(/DSN);';
// We need to get the prefix (pdodriver used by PDO).
$this->dsn = $this->hostname;
- $split_dsn = explode(':', $this->hostname);
- $this->pdodriver = $split_dsn[0];
-
- // End this part of the dsn with a semicolon
- $this->dsn .= rtrim(';', $this->dsn) . ';';
+ $this->pdodriver = current(explode(':', $this->hostname));
+
+ // End dsn with a semicolon for extra backward compability
+ // if database property was not empty.
+ if ( ! empty($this->database))
+ {
+ $this->dsn .= rtrim($this->dsn, ';').';';
+ }
}
else
{