summaryrefslogtreecommitdiffstats
path: root/system/database/DB.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-13 00:24:39 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-13 00:24:39 +0100
commit45ba4f73a13660fa05f30d2ec21965620b0e5be5 (patch)
treec772bdce17dd3542378f1c459cda268b0bcff402 /system/database/DB.php
parentfdfe808e85e9546fd1b2775cc79f640cd32660fa (diff)
Fix a possible bug in DB() and renamed a variable
Diffstat (limited to 'system/database/DB.php')
-rwxr-xr-xsystem/database/DB.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/system/database/DB.php b/system/database/DB.php
index d06ffb40e..8f9cb3743 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -74,24 +74,24 @@ function &DB($params = '', $active_record_override = NULL)
* parameter. DSNs must have this prototype:
* $dsn = 'driver://username:password@hostname/database';
*/
- if (($dns = @parse_url($params)) === FALSE)
+ if (($dsn = @parse_url($params)) === FALSE)
{
show_error('Invalid DB Connection String');
}
$params = array(
- 'dbdriver' => $dns['scheme'],
- 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '',
- 'port' => (isset($dns['port'])) ? rawurldecode($dns['port']) : '',
- 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '',
- 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '',
- 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : ''
+ 'dbdriver' => $dsn['scheme'],
+ 'hostname' => (isset($dsn['host'])) ? rawurldecode($dsn['host']) : '',
+ 'port' => (isset($dsn['port'])) ? rawurldecode($dsn['port']) : '',
+ 'username' => (isset($dsn['user'])) ? rawurldecode($dsn['user']) : '',
+ 'password' => (isset($dsn['pass'])) ? rawurldecode($dsn['pass']) : '',
+ 'database' => (isset($dsn['path'])) ? rawurldecode(substr($dsn['path'], 1)) : ''
);
// were additional config items set?
- if (isset($dns['query']))
+ if (isset($dsn['query']))
{
- parse_str($dns['query'], $extra);
+ parse_str($dsn['query'], $extra);
foreach ($extra as $key => $val)
{
// booleans please
@@ -104,7 +104,10 @@ function &DB($params = '', $active_record_override = NULL)
$val = FALSE;
}
- $params[$key] = $val;
+ if ( ! isset($params[$key]))
+ {
+ $params[$key] = $val;
+ }
}
}
}