Closed Bug 544506 Opened 14 years ago Closed 14 years ago

Bugzilla->input_params is undefined when calling Bugzilla.version and other methods taking no argument

Categories

(Bugzilla :: WebService, defect)

3.5.3
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

(Keywords: regression)

Attachments

(1 file)

Attached patch patch, v1Splinter Review
When you call Bugzilla.version, you don't pass any other argument. Consequently, $som->paramsin in Bugzilla::XMLRPC::Deserializer->deserialize() is undefined and so Bugzilla->input_params is not set, making subsequent calls to Bugzilla->input_params->{foo} to die with

# Can't use string ("") as a HASH ref while "strict refs" in use at Bugzilla/WebService/Server.pm line 24.

So if no parameters are passed, we should set Bugzilla->input_params to {} to avoid extra checks everywhere in the code.

This problem was found while running the webservice_bugzilla.t QA test script, see http://landfill.bugzilla.org/bugzillaqa/show_bug.cgi?id=3161
Flags: blocking3.6+
Attachment #425483 - Flags: review?(mkanat)
Maybe something like this?

=== modified file 'Bugzilla.pm'
--- Bugzilla.pm 2009-11-24 06:09:41 +0000
+++ Bugzilla.pm 2010-02-05 18:54:27 +0000
@@ -263,7 +263,7 @@
     # Making this scalar makes it a tied hash to the internals of $cgi,
     # so if a variable is changed, then it actually changes the $cgi object
     # as well.
-    $cache->{input_params} = $class->cgi->Vars;
+    $cache->{input_params} = $class->cgi->Vars ? $class->cgi->Vars : {};
     return $cache->{input_params};
 }
Comment on attachment 425483 [details] [diff] [review]
patch, v1

Awesome. Does this affect the JSON-RPC interface too, or just XML-RPC?
Attachment #425483 - Flags: review?(mkanat) → review+
Flags: approval3.6+
Flags: approval+
(In reply to comment #2)
> Awesome. Does this affect the JSON-RPC interface too, or just XML-RPC?

By looking at the source code of JSON::RPC::Server->_argument_type_check(), it seems to always return something defined, so I think XML-RPC only.
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/WebService/Server/XMLRPC.pm
Committed revision 6962.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/3.6/
modified Bugzilla/WebService/Server/XMLRPC.pm
Committed revision 6957.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
(In reply to comment #1)
> Maybe something like this?

dkl: I'm not sure about side effects this could have. JSON-RPC is not supposed to have this problem, and CGI scripts aren't either, so fixing this here may hide real unexpected bugs in the future, so maybe it's safer to fix it the way I did.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: