From 1a5f9b3b0f3505bdefcac3b9ffeabe9a849d3058 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Tue, 26 Sep 2006 02:10:57 +0000 Subject: [PATCH] query_error() can infinitely recurse as errors are inserted into the database and if the database doesn't exist then the db insertion will fail and result in a call to query_error(). Once we've entered query_error() once if we enter it again we should simply return --- include/query.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/query.php b/include/query.php index 4a127f7..a547d8a 100644 --- a/include/query.php +++ b/include/query.php @@ -138,6 +138,16 @@ function query_bugzilladb($sQuery,$sComment="") function query_error($sQuery, $sComment="") { + static $bInQueryError = false; + + // if we are already reporting an error we can't report it again + // as that indicates that error reporting itself produced an error + if($bInQueryError) + return; + + // record that we are inside of this function, we don't want to recurse + $bInQueryError = true; + error_log::log_error(ERROR_SQL, "Query: '".$sQuery."' ". "mysql_errno(): '".mysql_errno()."' ". "mysql_error(): '".mysql_error()."' ". @@ -145,6 +155,8 @@ function query_error($sQuery, $sComment="") $sStatusMessage = "

An internal error has occurred and has been logged and reported to appdb admins

"; addmsg($sStatusMessage); + + $bInQueryError = false; // clear variable upon exit } ?>