|
From: Bart v. B. <ba...@us...> - 2002-01-22 18:14:03
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv19642/includes
Modified Files:
functions.php
Log Message:
Fixed bug #505838, debug messages didn't show SQL errors
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/functions.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -r1.106 -r1.107
*** functions.php 2002/01/11 10:53:40 1.106
--- functions.php 2002/01/22 18:13:59 1.107
***************
*** 1018,1021 ****
--- 1018,1047 ----
$sql_store = $sql;
+
+ //
+ // Get SQL error if we are debugging. Do this as soon as possible to prevent
+ // subsequent queries from overwriting the status of sql_error()
+ //
+ if(DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
+ {
+ $sql_error = $db->sql_error();
+
+ $debug_text = "";
+
+ if($sql_error['message'] != "")
+ {
+ $debug_text .= "<br /><br />SQL Error : " . $sql_error['code'] . " " . $sql_error['message'];
+ }
+
+ if($sql_store != "")
+ {
+ $debug_text .= "<br /><br />$sql_store";
+ }
+
+ if($err_line != "" && $err_file != "")
+ {
+ $debug_text .= "</br /><br />Line : " . $err_line . "<br />File : " . $err_file;
+ }
+ }
if( empty($userdata) && ( $msg_code == GENERAL_MESSAGE || $msg_code == GENERAL_ERROR ) )
***************
*** 1117,1139 ****
if(DEBUG && ( $msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR ) )
{
- $sql_error = $db->sql_error();
-
- $debug_text = "";
-
- if($sql_error['message'] != "")
- {
- $debug_text .= "<br /><br />SQL Error : " . $sql_error['code'] . " " . $sql_error['message'];
- }
-
- if($sql_store != "")
- {
- $debug_text .= "<br /><br />$sql_store";
- }
-
- if($err_line != "" && $err_file != "")
- {
- $debug_text .= "</br /><br />Line : " . $err_line . "<br />File : " . $err_file;
- }
-
if($debug_text != "")
{
--- 1143,1146 ----
|