Merge pull request #3617 from ddorian1/develop
Catch exceptions in PDO constructor
This commit is contained in:
commit
56de36574b
|
@ -75,9 +75,11 @@ class dba {
|
||||||
if (isset($a->config["system"]["db_charset"])) {
|
if (isset($a->config["system"]["db_charset"])) {
|
||||||
$connect .= ";charset=".$a->config["system"]["db_charset"];
|
$connect .= ";charset=".$a->config["system"]["db_charset"];
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
$this->db = @new PDO($connect, $user, $pass);
|
$this->db = @new PDO($connect, $user, $pass);
|
||||||
if (!$this->db->errorCode()) {
|
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$this->connected = false;
|
||||||
}
|
}
|
||||||
} elseif (class_exists('mysqli')) {
|
} elseif (class_exists('mysqli')) {
|
||||||
$this->driver = 'mysqli';
|
$this->driver = 'mysqli';
|
||||||
|
|
Loading…
Reference in a new issue