Closed Bug 686904 Opened 13 years ago Closed 13 years ago

Removing an invalid URL from the See Also field crashes Bugzilla

Categories

(Bugzilla :: WebService, defect)

4.1.3
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

When webservice_bug_update_see_also.t passes { ids => ['public_bug'], remove => ['asdfasdfasdf'] } to Bug.update_see_also, Bugzilla crashes with: # Can't call method "isa" on an undefined value at Bugzilla/Bug.pm line 2892. # at Bugzilla/Bug.pm line 2892 # Bugzilla::Bug::remove_see_also('Bugzilla::Bug=HASH(0x9f997a0)', 'asdfasdfasdf') called at Bugzilla/WebService/Bug.pm line 734 # Bugzilla::WebService::Bug::update_see_also('Bugzilla::WebService::Server::JSONRPC::Bugzilla::WebService::...', 'HASH(0x9ad85d8)') called at (eval 1059) line 1 # eval ' $procedure->{code}->($self, @params) # ;' called at /usr/lib/perl5/vendor_perl/5.12.2/JSON/RPC/Server.pm line 220 # JSON::RPC::Server::_handle('Bugzilla::WebService::Server::JSONRPC::Bugzilla::WebService::...', 'HASH(0x9ad85b8)') called at Bugzilla/WebService/Server/JSONRPC.pm line 258 # Bugzilla::WebService::Server::JSONRPC::_handle('Bugzilla::WebService::Server::JSONRPC::Bugzilla::WebService::...', 'HASH(0x9ad85b8)') called at /usr/lib/perl5/vendor_perl/5.12.2/JSON/RPC/Server.pm line 126 # JSON::RPC::Server::handle('Bugzilla::WebService::Server::JSONRPC::Bugzilla::WebService::...') called at /var/www/html/bugzilla_qa42/jsonrpc.cgi line 41 Line 2892 in Bugzilla/Bug.pm is in remove_see_also(): if ($removed_bug_url->isa('Bugzilla::BugUrl::Bugzilla::Local') This means $removed_bug_url is undefined. No idea if that's expected or not.
Flags: blocking4.2+
Blocks: 683680
Attached patch patch, v1Splinter Review
$removed_bug_url is undefined if the given URL wasn't in the See Also list. So we have to check for it existence first.
Assignee: webservice → LpSolit
Status: NEW → ASSIGNED
Attachment #560721 - Flags: review?(timello)
Comment on attachment 560721 [details] [diff] [review] patch, v1 Review of attachment 560721 [details] [diff] [review]: ----------------------------------------------------------------- ::: Bugzilla/Bug.pm @@ +2889,5 @@ > # Since we remove also the url from the referenced bug, > # we need to notify changes for that bug too. > $removed_bug_url = $removed_bug_url->[0]; > + if ($removed_bug_url > + and $removed_bug_url->isa('Bugzilla::BugUrl::Bugzilla::Local') Well, actually, I don't think we should silent ignore invalid URL when trying to remove them... we should let the user know that he is trying to remove a URL which is not valid or does not exist for that bug.
Attachment #560721 - Flags: review?(timello) → review-
Comment on attachment 560721 [details] [diff] [review] patch, v1 No, the doc for the Bug.update_see_also WebService states that "If you specify a URL that is not in the See Also field of a particular bug, it will just be silently ignored.". Throwing an error would break backward-compatibility, and it has always worked this way since Bugzilla 3.4.
Attachment #560721 - Flags: review- → review?(timello)
Comment on attachment 560721 [details] [diff] [review] patch, v1 It fixes the problem.
Attachment #560721 - Flags: review?(timello) → review+
Flags: approval?
Flags: approval?
Flags: approval4.2+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Bug.pm Committed revision 7965. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/ modified Bugzilla/Bug.pm Committed revision 7933.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: