Skip to content

Commit

Permalink
Fix #12095: bug_monitor_copy() should check users exist
Browse files Browse the repository at this point in the history
bug_monitor_copy() assumes that all user IDs from the source bug are
still valid. We should first check to make sure that users from the
source bug still exist before adding them to the monitor list of the
destination bug.
  • Loading branch information
davidhicks committed Jun 23, 2010
1 parent fdaef4f commit 69c55f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/bug_api.php
Expand Up @@ -1769,7 +1769,8 @@ function bug_monitor_copy( $p_source_bug_id, $p_dest_bug_id ) {

for( $i = 0; $i < $t_count; $i++ ) {
$t_bug_monitor = db_fetch_array( $result );
if ( !user_is_monitoring_bug( $t_bug_monitor['user_id'], $c_dest_bug_id ) ) {
if ( user_exists( $t_bug_monitor['user_id'] ) &&
!user_is_monitoring_bug( $t_bug_monitor['user_id'], $c_dest_bug_id ) ) {
$query = 'INSERT INTO ' . $t_bug_monitor_table . ' ( user_id, bug_id )
VALUES ( ' . db_param() . ', ' . db_param() . ' )';
db_query_bound( $query, Array( $t_bug_monitor['user_id'], $c_dest_bug_id ) );
Expand Down

0 comments on commit 69c55f9

Please sign in to comment.