View Issue Details

IDProjectCategoryView StatusLast Update
0012504mantisbtadministrationpublic2010-12-17 04:40
Reporterdregad Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.2.4Fixed in Version1.2.4 
Summary0012504: Error on email and realname fields in Edit User page accessed by username
Description

When LDAP is enabled, editing a user from manage_user_page.php works as expected if using the hyperlink on the id (i.e. manage_user_edit_page.php?user_id=xxx).

However, when the edit page is accessed by username instead (i.e. manage_user_edit_page.php?username=xxx), the realname and email fields display the following error messages (see also screenshot):
APPLICATION WARNING #user_get_field() for NO_USER:
APPLICATION WARNING #user_get_field() for NO_USER:
@null@

Steps To Reproduce
  • LDAP in config_inc.php
  • Navigate to manage_user_page.php
  • Enter a valid username in the field at page bottom, and click on Manage User

Realname and Email fields display the error

Additional Information

This has been tested with git trunk 1.2.x, commit 325c6a1daa14621c3b86405ddfe65de102dac8f2.

Everything works as expected with DB authentication (MD5).

Tagspatch
Attached Files
Screenshot.png (40,688 bytes)   
Screenshot.png (40,688 bytes)   
fix-12504.patch (1,599 bytes)   
From f556a398f8bc2264f4e9fab584c32b2463fe5ead Mon Sep 17 00:00:00 2001
From: Damien Regad <damien.regad@merckserono.net>
Date: Tue, 2 Nov 2010 13:33:17 +0100
Subject: [PATCH] Fix #12504: Error in Edit User page when accessed by username

Use $t_user_id instead of $f_user_id variable, as the latter is not initialized when the user is identified by their username instead of id.

Also removed useless assignment of $f_user_id, as the variable is not referenced anymore.
---
 manage_user_edit_page.php |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/manage_user_edit_page.php b/manage_user_edit_page.php
index b0dd092..11f89f0 100644
--- a/manage_user_edit_page.php
+++ b/manage_user_edit_page.php
@@ -32,8 +32,7 @@
 	$f_username = gpc_get_string( 'username', '' );
 
 	if ( is_blank( $f_username ) ) {
-		$f_user_id = gpc_get_int( 'user_id' );
-		$t_user_id = $f_user_id;
+		$t_user_id = gpc_get_int( 'user_id' );
 	} else {
 		$t_user_id = user_get_id_by_name( $f_username );
 		if ( $t_user_id === false ) {
@@ -90,7 +89,7 @@
 		<?php
 			// With LDAP
 			if ( $t_ldap && ON == config_get( 'use_ldap_realname' ) ) {
-				echo string_display_line( user_get_realname( $f_user_id ) );
+				echo string_display_line( user_get_realname( $t_user_id ) );
 			}
 			// Without LDAP
 			else {
@@ -111,7 +110,7 @@
 		<?php
 			// With LDAP
 			if ( $t_ldap && ON == config_get( 'use_ldap_email' ) ) {
-				echo string_display_line( user_get_email( $f_user_id ) );
+				echo string_display_line( user_get_email( $t_user_id ) );
 			}
 			// Without LDAP
 			else {
-- 
1.7.1

fix-12504.patch (1,599 bytes)   

Relationships

has duplicate 0012466 closedatrol Error when searching for user in Mantis 1.2.3 

Activities

dregad

dregad

2010-11-02 08:36

developer   ~0027220

Problem was caused by an uninitialized variable. I attached a fix.

dhx

dhx

2010-11-19 09:16

reporter   ~0027421

Patch applied, thanks Damien!

Related Changesets

MantisBT: master 8b0fe3cd

2010-11-02 08:33

Damien Regad

Committer: dhx


Details Diff
Fix 0012504: Error in Edit User page when queried by LDAP username

Use $t_user_id instead of $f_user_id variable, as the latter is not initialized when the user is identified by their username instead of id.

Also removed useless assignment of $f_user_id, as the variable is not referenced anymore.

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
Affected Issues
0012504
mod - manage_user_edit_page.php Diff File

MantisBT: master-1.2.x 712ce667

2010-11-02 08:33

Damien Regad

Committer: dhx


Details Diff
Fix 0012504: Error in Edit User page when queried by LDAP username

Use $t_user_id instead of $f_user_id variable, as the latter is not initialized when the user is identified by their username instead of id.

Also removed useless assignment of $f_user_id, as the variable is not referenced anymore.

Signed-off-by: David Hicks <hickseydr@optusnet.com.au>
Affected Issues
0012504
mod - manage_user_edit_page.php Diff File