summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-07-04 14:14:50 +0200
committermkanat%bugzilla.org <>2009-07-04 14:14:50 +0200
commit914fb1e84d015ab400fe16e8a03ce7e552af9a05 (patch)
tree99009f1b54a0420553af9490c7ee2eaa8f13a973 /Bugzilla
parentaae4c29f12584652c90d395e6fc769d5ac6976c4 (diff)
downloadbugzilla-914fb1e84d015ab400fe16e8a03ce7e552af9a05.tar.gz
bugzilla-914fb1e84d015ab400fe16e8a03ce7e552af9a05.tar.xz
Bug 501538: Make $cgi->param() also check GET variables during a POST, so that POST forms with query-string variables in the target (like the login form) work correctly.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/CGI.pm23
1 files changed, 17 insertions, 6 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 4af6a933d..5a50dbbeb 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -276,17 +276,28 @@ sub header {
return $self->SUPER::header(@_) || "";
}
-# CGI.pm is not utf8-aware and passes data as bytes instead of UTF-8 strings.
sub param {
my $self = shift;
- if (Bugzilla->params->{'utf8'} && scalar(@_) == 1) {
- if (wantarray) {
- return map { _fix_utf8($_) } $self->SUPER::param(@_);
+
+ # When we are just requesting the value of a parameter...
+ if (scalar(@_) == 1) {
+ my @result = $self->SUPER::param(@_);
+
+ # Also look at the URL parameters, after we look at the POST
+ # parameters. This is to allow things like login-form submissions
+ # with URL parameters in the form's "target" attribute.
+ if (!scalar(@result) && $self->request_method eq 'POST') {
+ @result = $self->SUPER::url_param(@_);
}
- else {
- return _fix_utf8(scalar $self->SUPER::param(@_));
+
+ # Fix UTF-8-ness of input parameters.
+ if (Bugzilla->params->{'utf8'}) {
+ @result = map { _fix_utf8($_) } @result;
}
+
+ return wantarray ? @result : $result[0];
}
+
return $self->SUPER::param(@_);
}