From 7d331618db87ff7ae268b3c73d5f07ec122af9c2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Mon, 14 Dec 2009 23:07:08 +0000 Subject: Bug 523762: Prevent the template_before_process hook from causing an infinite recursion when an error is thrown Patch by Max Kanat-Alexander r=dkl, a=mkanat --- Bugzilla/Template.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Bugzilla/Template.pm') 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(@_); } -- cgit v1.2.3-24-g4f1b