Closed
Bug 1317507
Opened 9 years ago
Closed 9 years ago
Bug 1314201 causes multiple header error when posting a new bug due to Bugzilla::Util::template_var
Categories
(bugzilla.mozilla.org :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 1314201
People
(Reporter: dkl, Assigned: dylan)
Details
Attachments
(1 file)
|
799 bytes,
patch
|
dkl
:
review-
|
Details | Diff | Splinter Review |
Bugzilla::Util::template_var:768 loads global/field-descs.none.tmpl earlier in post_bug.cgi before $cgi->header is called for the last time. This causes Bugzilla::Template::process to print $cgi->header automatically when $output is undefined. So two possible solutions:
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 7937d6b..5f8844e 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -774,10 +774,11 @@ sub template_var {
my $template = Bugzilla->template_inner($lang);
my %vars;
+ my $output;
# Note: If we suddenly start needing a lot of template_var variables,
# they should move into their own template, not field-descs.
my $result = $template->process('global/field-descs.none.tmpl',
- { vars => \%vars, in_template_var => 1 });
+ { vars => \%vars, in_template_var => 1, \$output });
# Bugzilla::Error can't be "use"d in Bugzilla::Util.
if (!$result) {
require Bugzilla::Error;
OR
diff --git a/post_bug.cgi b/post_bug.cgi
index 0975e32..ab25bb4 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -264,7 +264,7 @@ $format = $template->get_format("bug/create/created",
# don't leak the enter_bug format param to show_bug
$cgi->delete('format');
-print $cgi->header();
+print $cgi->header() unless $cgi->sent_headers;
$template->process($format->{'template'}, $vars)
|| ThrowTemplateError($template->error());
I am curious if you know of a better way to fix.
dkl
| Reporter | ||
Comment 1•9 years ago
|
||
Actually I do not like the latter solution as it will make it impossible for a *.cgi to add custom CSP headers.
| Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8810647 -
Flags: review?(dkl)
| Assignee | ||
Updated•9 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
| Reporter | ||
Updated•9 years ago
|
Attachment #8810647 -
Flags: review?(dkl) → review-
| Reporter | ||
Comment 4•9 years ago
|
||
Sorry for lack of comment for r-. Mainly cause this bug is now resolved as a dupe but also since the the \$ignore workaround will need to be applied in other places as well such as user matching.
dkl
You need to log in
before you can comment on or make changes to this bug.
Description
•