From 28870e4b455fac22c82868adf605a26c7a3db5f3 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sun, 10 Feb 2019 12:11:58 +0000 Subject: [PATCH] explode if there is no db connection made --- functions.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/functions.inc.php b/functions.inc.php index a1170db5..f85e7361 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1433,11 +1433,16 @@ EOF; * * Return value: * - * @return \PDO|false + * @return \PDO */ function db_connect() { list($link, $_) = db_connect_with_errors(); unset($_); + + if(!$link instanceof PDO) { + throw new Exception("Database connection failed"); + } + return $link; }