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

RESOLVED FIXED in Bugzilla 3.6

Status

()

--
major
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: LpSolit, Assigned: LpSolit)

Tracking

({regression})

3.5.3
Bugzilla 3.6
regression
Bug Flags:
approval +
approval3.6 +
blocking3.6 +

Details

Attachments

(1 attachment)

(Assignee)

Description

9 years ago
Created attachment 425483 [details] [diff] [review]
patch, v1

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 2

9 years ago
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+

Updated

9 years ago
Flags: approval3.6+
Flags: approval+
(Assignee)

Comment 3

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

Comment 4

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

Comment 5

9 years ago
(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.