Closed Bug 819330 Opened 12 years ago Closed 12 years ago

Bugzilla crashes when cloning a bug if the CC list is empty

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: jolum1, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0
Build ID: 20121128204232

Steps to reproduce:

Attempted to clone an existing bug where the logged in user was not the reporter.


Actual results:

Bugzilla reported the following: 
Software error:
Can't use an undefined value as an ARRAY reference at /var/www/bugzilla/enter_bug.cgi line 217.



Expected results:

In  BZ v4.5 the code at line 217 reads: 
if ($cloned_bug->reporter->id != $user->id) 
        && none { $_ eq $cloned_bug->reporter->login } @{$cloned_bug->cc}) {
        $vars->{'cc'} = join (", ", $cloned_bug->reporter->login, $vars->{'cc'}); 
    }

In our previous version (3.4) it use to read:
if ($cloned_bug->reporter->id != $user->id) {       
        $vars->{'cc'} = join (", ", $cloned_bug->reporter->login, $vars->{'cc'}); 
    }
Confirmed. This happens only if there is nobody in the CC list of the original bug. This is a regression due to bug 715432.
Assignee: general → create-and-change
Status: UNCONFIRMED → NEW
Component: Bugzilla-General → Creating/Changing Bugs
Depends on: 715432
Ever confirmed: true
Flags: blocking4.4+
Keywords: regression
Summary: Error cloning bug → Bugzilla crashes when cloning a bug if the CC list is empty
Target Milestone: --- → Bugzilla 4.4
Attached patch patch, v1Splinter Review
The right fix is to make $bug->cc always return an arrayref. It doesn't make sense to return undef when the CC list is empty. Else this always force the callers to do something like @{$bug->cc || []} which is ridiculous.
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #689728 - Flags: review?(dkl)
Comment on attachment 689728 [details] [diff] [review]
patch, v1

Review of attachment 689728 [details] [diff] [review]:
-----------------------------------------------------------------

Works as expected. r=dkl
Attachment #689728 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval4.4?
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified enter_bug.cgi
modified Bugzilla/Bug.pm
modified Bugzilla/WebService/Bug.pm
Committed revision 8520.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified enter_bug.cgi
modified Bugzilla/Bug.pm
modified Bugzilla/WebService/Bug.pm
Committed revision 8485.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Blocks: 903337
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: