From 34c330f868135d7b7b2a146c54318eaa19e114a8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 18 Jul 2019 11:20:12 +0200 Subject: [PATCH] Proper use of the DebugPreparedStatement class Fixes #2955 --- wcfsetup/install/files/lib/system/WCF.class.php | 4 ++++ .../install/files/lib/system/database/Database.class.php | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 7f13bd6453..418180f678 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -389,6 +389,10 @@ class WCF { require($filename); } + + if (ENABLE_DEBUG_MODE) { + self::$dbObj->enableDebugMode(); + } } } diff --git a/wcfsetup/install/files/lib/system/database/Database.class.php b/wcfsetup/install/files/lib/system/database/Database.class.php index 1ee45f5aef..4c426bfd16 100644 --- a/wcfsetup/install/files/lib/system/database/Database.class.php +++ b/wcfsetup/install/files/lib/system/database/Database.class.php @@ -124,14 +124,14 @@ abstract class Database { $this->tryToCreateDatabase = $tryToCreateDatabase; $this->defaultDriverOptions = $defaultDriverOptions; - if (defined('ENABLE_DEBUG_MODE') && ENABLE_DEBUG_MODE) { - $this->preparedStatementClassName = DebugPreparedStatement::class; - } - // connect database $this->connect(); } + public function enableDebugMode() { + $this->preparedStatementClassName = DebugPreparedStatement::class; + } + /** * Connects to database server. */ -- 2.20.1