From: Jakub Vrana Date: Thu, 8 Aug 2013 23:44:39 +0000 (-0700) Subject: Simplify exception handling in PHP 5 X-Git-Tag: v4.0.0~70 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=faabb9ef384e3a798fc2ee411f52760ef0bb7a10;p=adminer.git Simplify exception handling in PHP 5 --- diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index ee2e8396..a4795342 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -12,10 +12,13 @@ if (extension_loaded('pdo')) { } } - function dsn($dsn, $username, $password, $exception_handler = 'auth_error') { - set_exception_handler($exception_handler); // try/catch is not compatible with PHP 4 - parent::__construct($dsn, $username, $password); - restore_exception_handler(); + function dsn($dsn, $username, $password) { + try { + parent::__construct($dsn, $username, $password); + } catch (Exception $ex) { + auth_error($ex); + exit; + } $this->setAttribute(13, array('Min_PDOStatement')); // 13 - PDO::ATTR_STATEMENT_CLASS $this->server_info = $this->getAttribute(4); // 4 - PDO::ATTR_SERVER_VERSION }