summaryrefslogtreecommitdiff
path: root/program/include/rcube_db.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-07-06 09:48:32 +0200
committerAleksander Machniak <alec@alec.pl>2012-07-06 09:48:32 +0200
commite6e5cb12f5aa93677fe8a373c56bd212a60a82ae (patch)
treeaa71a5644ddeb8444778486111b0d09d0386cb07 /program/include/rcube_db.php
parent8c2375a07443231cad32bd4cbd1d9ffbd1aa5087 (diff)
Handle properly situation when PDO class doesn't exist
Diffstat (limited to 'program/include/rcube_db.php')
-rw-r--r--program/include/rcube_db.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php
index 2ee562395..ba7b96c9d 100644
--- a/program/include/rcube_db.php
+++ b/program/include/rcube_db.php
@@ -137,6 +137,11 @@ class rcube_db
// Connect
try {
+ // with this check we skip fatal error on PDO object creation
+ if (!class_exists('PDO', false)) {
+ throw new Exception('PDO extension not loaded. See http://php.net/manual/en/intro.pdo.php');
+ }
+
$this->conn_prepare($dsn);
$dbh = new PDO($dsn_string, $dsn['username'], $dsn['password'], $dsn_options);
@@ -144,7 +149,7 @@ class rcube_db
// don't throw exceptions or warnings
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
}
- catch (PDOException $e) {
+ catch (Exception $e) {
$this->db_error = true;
$this->db_error_msg = $e->getMessage();