Bug 323031: process_bug.cgi crashes when encountering a deleted user account and when strict_isolation is on - Patch by Fr��d��ric Buclin <LpSolit@gmail.com> r=wicked a=justdave

This commit is contained in:
lpsolit%gmail.com 2006-11-14 19:02:01 +00:00
Родитель 59fbd04f10
Коммит bf2e229346
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -1342,7 +1342,8 @@ if ($prod_changed && Bugzilla->params->{"strict_isolation"}) {
$sth_cc->execute($id); $sth_cc->execute($id);
my @blocked_cc = (); my @blocked_cc = ();
while (my ($pid) = $sth_cc->fetchrow_array) { while (my ($pid) = $sth_cc->fetchrow_array) {
$usercache{$pid} ||= Bugzilla::User->new($pid); # Ignore deleted accounts. They will never get notification.
$usercache{$pid} ||= Bugzilla::User->new($pid) || next;
my $cc_user = $usercache{$pid}; my $cc_user = $usercache{$pid};
if (!$cc_user->can_edit_product($product->id)) { if (!$cc_user->can_edit_product($product->id)) {
push (@blocked_cc, $cc_user->login); push (@blocked_cc, $cc_user->login);
@ -1357,7 +1358,7 @@ if ($prod_changed && Bugzilla->params->{"strict_isolation"}) {
$sth_bug->execute($id); $sth_bug->execute($id);
my ($assignee, $qacontact) = $sth_bug->fetchrow_array; my ($assignee, $qacontact) = $sth_bug->fetchrow_array;
if (!$assignee_checked) { if (!$assignee_checked) {
$usercache{$assignee} ||= Bugzilla::User->new($assignee); $usercache{$assignee} ||= Bugzilla::User->new($assignee) || next;
my $assign_user = $usercache{$assignee}; my $assign_user = $usercache{$assignee};
if (!$assign_user->can_edit_product($product->id)) { if (!$assign_user->can_edit_product($product->id)) {
ThrowUserError('invalid_user_group', ThrowUserError('invalid_user_group',
@ -1367,7 +1368,7 @@ if ($prod_changed && Bugzilla->params->{"strict_isolation"}) {
} }
} }
if (!$qacontact_checked && $qacontact) { if (!$qacontact_checked && $qacontact) {
$usercache{$qacontact} ||= Bugzilla::User->new($qacontact); $usercache{$qacontact} ||= Bugzilla::User->new($qacontact) || next;
my $qa_user = $usercache{$qacontact}; my $qa_user = $usercache{$qacontact};
if (!$qa_user->can_edit_product($product->id)) { if (!$qa_user->can_edit_product($product->id)) {
ThrowUserError('invalid_user_group', ThrowUserError('invalid_user_group',