mirror of
https://github.com/vrana/adminer.git
synced 2025-08-14 10:34:01 +02:00
Simplify exception handling in PHP 5
This commit is contained in:
@@ -12,10 +12,13 @@ if (extension_loaded('pdo')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dsn($dsn, $username, $password, $exception_handler = 'auth_error') {
|
function dsn($dsn, $username, $password) {
|
||||||
set_exception_handler($exception_handler); // try/catch is not compatible with PHP 4
|
try {
|
||||||
parent::__construct($dsn, $username, $password);
|
parent::__construct($dsn, $username, $password);
|
||||||
restore_exception_handler();
|
} catch (Exception $ex) {
|
||||||
|
auth_error($ex);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
$this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS
|
||||||
$this->server_info = $this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
$this->server_info = $this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user