View Issue Details

IDProjectCategoryView StatusLast Update
0003363mantisbtbugtrackerpublic2003-12-13 04:35
Reporteraarjona Assigned Toaarjona  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Summary0003363: Fatal error when the wrong database is specified.
Description

The $g_dbconnected variable is not set to false before triggering the error handler, so the html* functions attempt to display db-related content.

TagsNo tags attached.
Attached Files
mantis_issue_3363.patch (787 bytes)   
Index: core/database_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/database_api.php,v
retrieving revision 1.17
diff -u -r1.17 database_api.php
--- core/database_api.php	19 Feb 2003 18:06:07 -0000	1.17
+++ core/database_api.php	17 Sep 2003 01:28:16 -0000
@@ -92,10 +92,16 @@
 
 	# --------------------
 	function db_select_db( $p_db_name ) {
+		global $g_db_connected;
 		$t_result = @mysql_select_db( $p_db_name );
 
 		if ( !$t_result ) {
 			db_error();
+			db_close();
+			# we got the wrong database so we're basically not connected.
+			# this prevents the html functions from trying to display db stuff
+			$g_db_connected = false;
+
 			trigger_error( ERROR_DB_SELECT_FAILED, ERROR );
 			return false;
 		}
mantis_issue_3363.patch (787 bytes)   

Activities

aarjona

aarjona

2003-09-17 03:29

reporter   ~0004629

Patch against trunk uploaded.

aarjona

aarjona

2003-09-17 03:35

reporter   ~0004630

Patch checked in.

Related Changesets

MantisBT: master 1df1ce17

2003-09-16 21:32

beerfrick


Details Diff
Issue 0003363: Fatal error when the wrong database is specified.

Modified Files:
core/database_api.php
----------------------------------------------------------------------

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2265 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0003363
mod - core/database_api.php Diff File