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

RESOLVED FIXED in Bugzilla 4.4

Status

()

RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: jolum1, Assigned: LpSolit)

Tracking

({regression})

Bugzilla 4.4
regression
Dependency tree / graph
Bug Flags:
approval +
approval4.4 +
blocking4.4 +

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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'}); 
    }
(Assignee)

Comment 1

6 years ago
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
(Assignee)

Comment 2

6 years ago
Created attachment 689728 [details] [diff] [review]
patch, v1

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+

Updated

6 years ago
Flags: approval?
Flags: approval4.4?
(Assignee)

Updated

6 years ago
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval+
(Assignee)

Comment 4

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Blocks: 903337
You need to log in before you can comment on or make changes to this bug.