Fixed bug #9480: Enhance debug information with SQL data
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Sat, 18 Oct 2008 11:47:41 +0000 (11:47 +0000)
committerDmitry Dulepov <dmitry.dulepov@gmail.com>
Sat, 18 Oct 2008 11:47:41 +0000 (11:47 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4322 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_db.php

index 5dfe7d5..500e61f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-18  Dmitry Dulepov  <dmitry@typo3.org>
+
+       * Fixed bug #9480: Enhance debug information with SQL data (thanks to Francois Suter for the inspiration)
+
 2008-10-17  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Fixed bug #9498: Bug: EM "Check for extension updates" always warns about changes (thanks to Christian Kuhn)
index 4c80fe4..4c3f0ee 100755 (executable)
@@ -1185,7 +1185,17 @@ class t3lib_DB {
                        }
                        $msg .= ': function t3lib_DB->' . $trace[0]['function'] . ' called from file ' . substr($trace[0]['file'],strlen(PATH_site)+2) . ' in line ' . $trace[0]['line'];
                        t3lib_div::sysLog($msg.'. Use a devLog extension to get more details.', 'Core/t3lib_db', 3);
-                       t3lib_div::devLog($msg.'.', 'Core/t3lib_db', 3, $trace);
+                       // Send to devLog if enabled
+                       if (TYPO3_DLOG) {
+                               $debugLogData = array(
+                                       'SQL Error' => $this->sql_error(),
+                                       'Backtrace' => $trace,
+                               );
+                               if ($this->debug_lastBuiltQuery) {
+                                       $debugLogData = array('SQL Query' => $this->debug_lastBuiltQuery) + $debugLogData;
+                               }
+                               t3lib_div::devLog($msg . '.', 'Core/t3lib_db', 3, $debugLogData);
+                       }
 
                        return FALSE;
                }