summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-12-15 00:07:08 +0100
committermkanat%bugzilla.org <>2009-12-15 00:07:08 +0100
commit7d331618db87ff7ae268b3c73d5f07ec122af9c2 (patch)
treee8920de2fbefac7c0523832dacc2586431c85eb4 /Bugzilla/Template.pm
parent6ffb51d5e4588d65895854b88a1d1ef089cd2283 (diff)
downloadbugzilla-7d331618db87ff7ae268b3c73d5f07ec122af9c2.tar.gz
bugzilla-7d331618db87ff7ae268b3c73d5f07ec122af9c2.tar.xz
Bug 523762: Prevent the template_before_process hook from causing an infinite recursion when an error is thrown
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 028914164..c8e3bc69c 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -86,9 +86,15 @@ sub process {
my $self = shift;
my ($file, $vars) = @_;
- #Bugzilla::Hook::process('template_before_process',
- # { vars => $vars, file => $file,
- # template => $self });
+ # This hook can't call itself recursively, because otherwise we
+ # end up with problems when we throw an error inside of extensions
+ # (they end up in infinite recursion, because throwing an error involves
+ # processing a template).
+ if (!Bugzilla::Hook::in('template_before_process')) {
+ Bugzilla::Hook::process('template_before_process',
+ { vars => $vars, file => $file,
+ template => $self });
+ }
return $self->SUPER::process(@_);
}