Proper use of the DebugPreparedStatement class
authorAlexander Ebert <ebert@woltlab.com>
Thu, 18 Jul 2019 09:20:12 +0000 (11:20 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 18 Jul 2019 09:20:12 +0000 (11:20 +0200)
Fixes #2955

wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/database/Database.class.php

index 7f13bd6453482101b20adbc980415d6f8dded653..418180f678bdf969c17229610ebb6d6d36dbc972 100644 (file)
@@ -389,6 +389,10 @@ class WCF {
                                
                                require($filename);
                        }
+                       
+                       if (ENABLE_DEBUG_MODE) {
+                               self::$dbObj->enableDebugMode();
+                       }
                }
        }
        
index 1ee45f5aeff3a6ba543f222d0144df34fffd0738..4c426bfd16e96eb9cdfa02f8ccd1b8d5838060bb 100644 (file)
@@ -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.
         */