appdb/include query.php

WineHQ wineowner at wine.codeweavers.com
Mon Sep 25 21:11:05 CDT 2006


ChangeSet ID:	28239
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2006/09/25 21:10:59

Modified files:
	include        : query.php 

Log message:
	Chris Morgan <cmorgan at alum.wpi.edu>
	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

Patch: http://cvs.winehq.org/patch.py?id=28239

Old revision  New revision  Changes     Path
 1.7           1.8           +12 -0      appdb/include/query.php

Index: appdb/include/query.php
diff -u -p appdb/include/query.php:1.7 appdb/include/query.php:1.8
--- appdb/include/query.php:1.7	26 Sep 2006  2:10:59 -0000
+++ appdb/include/query.php	26 Sep 2006  2:10:59 -0000
@@ -138,6 +138,16 @@ function query_bugzilladb($sQuery,$sComm
 
 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
 }
 
 ?>



More information about the wine-cvs mailing list