View Issue Details

IDProjectCategoryView StatusLast Update
0006850mantisbtlocalizationpublic2007-10-04 01:40
Reporterjiangxin Assigned Togiallu  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.1.0rc1 
Summary0006850: obsolete MANTIS_ERROR
Description

$MANTIS_ERROR isn't global variable any more. These code are obsolete.

diff --exclude=CVS -u -r mantis-sf-mirror/core/print_api.php mantis/core/print_api.php
--- mantis-sf-mirror/core/print_api.php 2006-03-15 16:44:42.265625000 +0800
+++ mantis/core/print_api.php 2006-03-15 16:41:44.390625000 +0800
@@ -1387,9 +1397,9 @@

this function should rarely (if ever) be reached. instead the db_()

# functions should trap (although inelegantly).
function print_sql_error( $p_query ) {
  • global $MANTIS_ERROR, $g_administrator_email;
  • PRINT $MANTIS_ERROR[ERROR_SQL];
  • global $g_administrator_email;
  • PRINT error_string( ERROR_SQL );
    print_email_link( $g_administrator_email, lang_get( 'administrator' ) );
    PRINT "
    $p_query;
    ";
    }
    @@ -1397,10 +1407,10 @@

    This is our generic error printing function

    Errors should terminate the script immediately

    function print_mantis_error( $p_error_num=0 ) {

  • global $MANTIS_ERROR;
  • PRINT '<html><head></head><body>';
  • PRINT $MANTIS_ERROR[$p_error_num];
  • PRINT '<html><head>';
  • PRINT '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
  • PRINT '</head><body>';
  • PRINT error_string( $p_error_num );
    PRINT '</body></html>';
    exit;
    }
    diff --exclude=CVS -u -r mantis-sf-mirror/manage_user_prune.php mantis/manage_user_prune.php
    --- mantis-sf-mirror/manage_user_prune.php 2006-03-15 16:44:39.687500000 +0800
    +++ mantis/manage_user_prune.php 2006-03-15 16:41:43.593750000 +0800
    @@ -39,6 +39,6 @@
    if ( $result ) {
    print_header_redirect( $t_redirect_url );
    } else {
  • print_mantis_error( ERROR_GENERIC );
  • trigger_error( ERROR_GENERIC, ERROR );
    }
    ?>
TagsNo tags attached.
Attached Files
mantis-print_error.diff (794 bytes)   
Index: core/print_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v
retrieving revision 1.174
diff -u -p -d -r1.174 print_api.php
--- core/print_api.php	29 Jul 2007 17:32:14 -0000	1.174
+++ core/print_api.php	4 Aug 2007 06:59:28 -0000
@@ -1524,9 +1524,9 @@
 	# this function should rarely (if ever) be reached.  instead the db_()
 	# functions should trap (although inelegantly).
 	function print_sql_error( $p_query ) {
-		global $MANTIS_ERROR, $g_administrator_email;
+		global $g_administrator_email;
 
-		PRINT $MANTIS_ERROR[ERROR_SQL];
+		PRINT error_string( ERROR_SQL );
 		print_email_link( $g_administrator_email, lang_get( 'administrator' ) );
 		PRINT "<br />$p_query;<br />";
 	}
mantis-print_error.diff (794 bytes)   

Activities

vboctor

vboctor

2006-09-29 03:00

manager   ~0013547

If this issue still exists, then we need to fix it.

Martin Fuchs

Martin Fuchs

2007-08-03 17:55

reporter   ~0015340

Last edited: 2007-08-03 17:56

Yes, the function error_string() is defined in core/error_api.php and should be used instead of the direct access to MANTIS_ERROR.

Martin Fuchs

Martin Fuchs

2007-08-04 03:03

reporter   ~0015342

Since part of the problems (including the change in manage_user_prune.php) are already been solved by other patches I uploaded an updated patch file for this issue. It just replaces the MANTIS_ERROR access by an call to error_string().

giallu

giallu

2007-08-04 05:06

reporter   ~0015343

Fixed. thanks for the patch

Related Changesets

MantisBT: master 656e7818

2007-08-04 05:05

giallu


Details Diff
Fix 6850: obsolete MANTIS_ERROR usage

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