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
This commit is contained in:
Chris Morgan
2006-09-26 02:10:57 +00:00
committed by WineHQ
parent 57b05023ed
commit 1a5f9b3b0f

View File

@@ -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 = "<p><b>An internal error has occurred and has been logged and reported to appdb admins</b></p>";
addmsg($sStatusMessage);
$bInQueryError = false; // clear variable upon exit
}
?>