View Issue Details

IDProjectCategoryView StatusLast Update
0012884mantisbtinstallationpublic2011-10-23 19:14
Reporterdregad Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.2.5Fixed in Version1.2.5 
Summary0012884: Checks for obsolete config fails to report error
Description

As part of admin checks, function config_obsolete in core/config_api.php is called to validate that deprecated configs (defined in core/obsolete.php) are not used in the system. If yes, a warning should be issued.

There is a bug in the function: it does not reports failure, and the admin has to click on the link to view passed tests to see the warning, e.g.

Warning: The configuration option $g_ldap_port is now obsolete
GOOD

Steps To Reproduce

Define in config_inc.php a parameter that is listed in core/obsolete.php and execute admin/check.php

Tagspatch
Attached Files
0001-Fix-12884-Checks-for-obsolete-config-fails-to-report.patch (1,614 bytes)   
From 43547be5ec1e41f3724a4349953aee8bf9fa19e6 Mon Sep 17 00:00:00 2001
From: Damien Regad <damien.regad@merckserono.net>
Date: Mon, 28 Mar 2011 19:55:49 +0200
Subject: [PATCH] Fix #12884: Checks for obsolete config fails to report error

Function config_obsolete in core/config_api.php failed to report deprecated
configs defined in core/obsolete.php and displaying replacement parameter,
due to inverted parameters in call to print_test_warn_row.

Also fixes an error when calling the function with a single parameter (as
is sometimes the case in obsolete.php) by making the 2nd parameter optional
and defaulting to ''.
---
 core/config_api.php |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/config_api.php b/core/config_api.php
index 12609de..3790350 100644
--- a/core/config_api.php
+++ b/core/config_api.php
@@ -521,7 +521,7 @@ function config_flush_cache( $p_option = '', $p_user = ALL_USERS, $p_project = A
 # ------------------
 # Checks if an obsolete configuration variable is still in use.  If so, an error
 # will be generated and the script will exit.  This is called from admin_check.php.
-function config_obsolete( $p_var, $p_replace ) {
+function config_obsolete( $p_var, $p_replace = '' ) {
 
 	# @@@ we could trigger a WARNING here, once we have errors that can
 	#     have extra data plugged into them (we need to give the old and
@@ -542,7 +542,7 @@ function config_obsolete( $p_var, $p_replace ) {
 			$t_info = '';
 		}
 
-		print_test_warn_row( $t_description, $t_info, false );
+		print_test_warn_row( $t_description, false, $t_info );
 	}
 }
 
-- 
1.7.1

Relationships

related to 0012885 closeddregad Reimplement obsolete configuration checks based on obsolete.php as part of new admin/check/ interface 

Activities

dregad

dregad

2011-03-28 14:23

developer   ~0028492

Patch attached (for 1.2.x branch only).

The patch also fixes an incorrect behavior: some deprecated parameters in obsolete.php are defined with a single parameter, like this:

config_obsolete( 'xxxx' );

however as the function definition expects 2 parameters, the above would result in an error:

SYSTEM WARNING: Missing argument 2 for config_obsolete(), called in /app/mantis/1.2.x/core/obsolete.php on line N

To avoid this, 2nd function parameter has been made optional, defaulting to '';

Note: in 1.3.x, obsolete.php does not seem to be used - David please confirm if this is normal.

dhx

dhx

2011-03-29 08:22

reporter   ~0028502

Thanks Damien, committed.

For 1.3.x I guess I forgot about adding obsolete.php checks as part of the rewritten admin/check/ interface. I've filed bug 0012885 to track progress on this issue for 1.3.x.

Related Changesets

MantisBT: master 47e65b23

2009-12-22 17:55

Paul Richards


Details Diff
Fix: check.php was showing 'good' for obsolete variable warnings due to wrong order of params. Affected Issues
0012884
mod - core/config_api.php Diff File

MantisBT: master-1.2.x 96efb7b6

2011-03-28 13:55

Damien Regad

Committer: dhx


Details Diff
Fix 0012884: Checks for obsolete config fails to report error

Function config_obsolete in core/config_api.php failed to report deprecated
configs defined in core/obsolete.php and displaying replacement parameter,
due to inverted parameters in call to print_test_warn_row.

Also fixes an error when calling the function with a single parameter (as
is sometimes the case in obsolete.php) by making the 2nd parameter optional
and defaulting to ''.

Signed-off-by: David Hicks <d@hx.id.au>
Affected Issues
0012884
mod - core/config_api.php Diff File