From 9f8344e53cafa2df432f6d74e3e3310bdfed025a Mon Sep 17 00:00:00 2001 From: Takashi SHIRAI Date: Wed, 19 Mar 2025 15:23:02 +0900 Subject: [PATCH] Fix the uncaught exception because of namespace. Signed-off-by: Takashi SHIRAI --- adminer/drivers/sqlite.inc.php | 2 +- adminer/include/pdo.inc.php | 2 +- plugins/drivers/mongo.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index 5d64a3be..a4352150 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -393,7 +393,7 @@ if (isset($_GET["sqlite"])) { } try { $link = new SqliteDb($db); - } catch (Exception $ex) { + } catch (\Exception $ex) { $connection->error = $ex->getMessage(); return false; } diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index 51171cc1..6cda3ae0 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -13,7 +13,7 @@ if (extension_loaded('pdo')) { $options[\PDO::ATTR_STATEMENT_CLASS] = array('Adminer\PdoDbStatement'); try { $this->pdo = new \PDO($dsn, $username, $password, $options); - } catch (Exception $ex) { + } catch (\Exception $ex) { auth_error(h($ex->getMessage())); } $this->server_info = @$this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION); diff --git a/plugins/drivers/mongo.php b/plugins/drivers/mongo.php index ac29c226..8d9d8d8d 100644 --- a/plugins/drivers/mongo.php +++ b/plugins/drivers/mongo.php @@ -25,7 +25,7 @@ if (isset($_GET["mongo"])) { function executeDbCommand($db, $command) { try { return $this->_link->executeCommand($db, new \MongoDB\Driver\Command($command)); - } catch (Exception $e) { + } catch (\Exception $e) { $this->error = $e->getMessage(); return array(); } @@ -36,7 +36,7 @@ if (isset($_GET["mongo"])) { $results = $this->_link->executeBulkWrite($namespace, $bulk); $this->affected_rows = $results->$counter(); return true; - } catch (Exception $e) { + } catch (\Exception $e) { $this->error = $e->getMessage(); return false; } @@ -331,7 +331,7 @@ if (isset($_GET["mongo"])) { $skip = $page * $limit; try { return new Result($this->conn->_link->executeQuery($this->conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort)))); - } catch (Exception $e) { + } catch (\Exception $e) { $this->conn->error = $e->getMessage(); return false; }