From feb65adcdf7068a1c2cd0603b25d8b09fd593cfa Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Tue, 21 Apr 2015 00:51:07 +0200 Subject: [PATCH] Fix printing user lists from filters Commit 1ddb400815dd847adbb302f1dda9b1fe3fdc5945 introduced a regression, preventing the users list from being printed on view_all_bug_page.php. This is due to the fact that when called by filters, $p_user_id is actually an array of id's, a case that was not documented and not considered when developping the fix for issue #17574. Fixes #19638 --- core/print_api.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/print_api.php b/core/print_api.php index 9936ecfa51..288a3d3e73 100644 --- a/core/print_api.php +++ b/core/print_api.php @@ -262,9 +262,9 @@ function print_captcha_input( $p_field_name ) { /** * This populates an option list with the appropriate users by access level * @todo from print_reporter_option_list - * @param integer $p_user_id A user identifier. - * @param integer $p_project_id A project identifier. - * @param integer $p_access An access level. + * @param integer|array $p_user_id A user identifier or a list of them. + * @param integer $p_project_id A project identifier. + * @param integer $p_access An access level. * @return void */ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { @@ -296,8 +296,13 @@ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = A $t_users = project_get_all_user_rows( $p_project_id, $p_access ); } - # Ensure the specified user exists in the array - if( $p_user_id != NO_USER && !array_key_exists( $p_user_id, $t_users ) ) { + # Add the specified user ID to the list + # If we have an array of user IDs, then we've been called from a filter + # so don't add anything + if( !is_array( $p_user_id ) && + $p_user_id != NO_USER && + !array_key_exists( $p_user_id, $t_users ) + ) { $t_users[$p_user_id] = user_get_row( $p_user_id ); }