From: Alexander Ebert Date: Thu, 18 Jul 2019 09:20:12 +0000 (+0200) Subject: Proper use of the DebugPreparedStatement class X-Git-Tag: 5.2.0_Alpha_2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=34c330f868135d7b7b2a146c54318eaa19e114a8;p=GitHub%2FWoltLab%2FWCF.git Proper use of the DebugPreparedStatement class Fixes #2955 --- 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. */