From 972c2e6520c40090bcec4df3ad9c36504e01b899 Mon Sep 17 00:00:00 2001 From: Wruczek Date: Fri, 1 Feb 2019 03:05:56 +0100 Subject: [PATCH] Fixed a bug during installation It set the "option" on the dbconfig and saved it to the config file as a string. Then it failed to load the file. --- src/installer/pages/3.php | 7 ++++--- src/private/php/Utils/DatabaseUtils.php | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/installer/pages/3.php b/src/installer/pages/3.php index b399ce0..19ebd41 100644 --- a/src/installer/pages/3.php +++ b/src/installer/pages/3.php @@ -43,14 +43,15 @@ if (!empty($_POST)) { // try to connect only if dbconfig is defined if (isset($dbconfig)) { try { - // Enable DB exceptions instead of silent fails - $dbconfig += [ + $errmodeException = [ "option" => [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ] ]; - $db = new Medoo($dbconfig); + // Enable DB exceptions instead of silent fails, only for the Medoo + // object and not for the dbConfig, we dont want to get it saved + $db = new Medoo($dbconfig + $errmodeException); $sqlfiles = []; diff --git a/src/private/php/Utils/DatabaseUtils.php b/src/private/php/Utils/DatabaseUtils.php index 07ea3c8..a090348 100644 --- a/src/private/php/Utils/DatabaseUtils.php +++ b/src/private/php/Utils/DatabaseUtils.php @@ -32,10 +32,8 @@ class DatabaseUtils { $config = $this->configUtils->getDatabaseConfig(); // Enable DB exceptions instead of silent fails - $config += [ - "option" => [ - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ] + $config["config"] = [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]; $db = new Medoo($config);