Merge pull request #244 from 8ctopus/master

fix setup db_connect_with_errors PDO exceptions were not caught
pull/245/head
David Goodwin 7 years ago committed by GitHub
commit 76e30d1dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1495,19 +1495,23 @@ function db_connect_with_errors() {
die("<p style='color: red'>FATAL Error:<br />Invalid \$CONF['database_type']! Please fix your config.inc.php!</p>");
}
if ($username_password) {
$link = new PDO($dsn, Config::read_string('database_user'), Config::read_string('database_password'), $options);
} else {
$link = new PDO($dsn, null, null, $options);
}
try {
if ($username_password) {
$link = new PDO($dsn, Config::read_string('database_user'), Config::read_string('database_password'), $options);
} else {
$link = new PDO($dsn, null, null, $options);
}
if (!empty($queries)) {
foreach ($queries as $q) {
$link->exec($q);
if (!empty($queries)) {
foreach ($queries as $q) {
$link->exec($q);
}
}
} catch (PDOException $e) {
$error_text = 'PDO exception: '. $e->getMessage();
error_log($error_text);
}
return array($link, $error_text);
}

Loading…
Cancel
Save