summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-02-12 22:04:56 +0100
committerTaufan Aditya <toopay@taufanaditya.com>2012-02-12 22:04:56 +0100
commit9c2947a339f24e13aaf85f115bcea9f27fa10a83 (patch)
treec54eef5f798ab02a4f385f989bcb8c1eb6ce19eb /system/database/drivers/pdo
parentde7da338e21885b9ecc4f5a64ba77ee8475960d2 (diff)
Fixed rtrim issue in hostname fragment, for backward compability
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php8
1 files changed, 3 insertions, 5 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index e84c1aaaf..2138ed665 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -117,11 +117,7 @@ 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));
}
else
{
@@ -179,6 +175,8 @@ class CI_DB_pdo_driver extends CI_DB {
// Add charset to the DSN, if needed
if ( ! empty($this->char_set) && in_array($this->pdodriver, array('4D', 'mysql', 'sybase', 'mssql', 'dblib', 'oci')))
{
+ // End dsn with a semicolon for extra backward compability
+ $this->dsn .= rtrim($this->dsn, ';').';';
$this->dsn .= 'charset='.$this->char_set.';';
}
}