summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-11-12 17:41:08 +0100
committerDylan William Hardison <dylan@hardison.net>2016-11-12 17:41:20 +0100
commit874e96c2423c772564c9dc63254baa99e86f270b (patch)
tree21e396b52b8fa54a3da946b90f5242992e660aee /Bugzilla/Template.pm
parent085878323cb82810bc2cd3f00ce925bb49c70156 (diff)
downloadbugzilla-874e96c2423c772564c9dc63254baa99e86f270b.tar.gz
bugzilla-874e96c2423c772564c9dc63254baa99e86f270b.tar.xz
Bug 1314201 - ThrowUserError and ThrowCodeError should print headers if headers have not already been printed
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index eb1496fca..dec9885c2 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -653,10 +653,21 @@ our $is_processing = 0;
sub process {
my $self = shift;
+ my ($template, undef, $output) = @_;
+
+ if (!$output && Bugzilla->usage_mode == USAGE_MODE_BROWSER) {
+ # if $output is not passed, this will print.
+ my $cgi = Bugzilla->cgi;
+ unless ($cgi->sent_headers) {
+ warn "attempted to process $template before sending headers!";
+ print $cgi->header();
+ }
+ }
+
# All of this current_langs stuff allows template_inner to correctly
# determine what-language Template object it should instantiate.
my $current_langs = Bugzilla->request_cache->{template_current_lang} ||= [];
- unshift(@$current_langs, $self->context->{bz_language});
+ unshift @$current_langs, $self->context->{bz_language};
local $is_processing = 1;
my $retval = $self->SUPER::process(@_);
shift @$current_langs;