]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1427230 - Avoid loading CGI::Carp, which makes templates slow.
authorDylan William Hardison <dylan@hardison.net>
Thu, 28 Dec 2017 01:34:35 +0000 (20:34 -0500)
committerGitHub <noreply@github.com>
Thu, 28 Dec 2017 01:34:35 +0000 (20:34 -0500)
Bugzilla/Sentry.pm
Bugzilla/Template.pm

index 8020ef56fd306fcf73c9897e182b8e6a420501f3..0d7a9c980f8c4298e2b9465e772758d7939fb38d 100644 (file)
@@ -358,9 +358,8 @@ sub _sentry_die_handler {
 }
 
 sub install_sentry_handler {
-    require CGI::Carp;
-    CGI::Carp::set_die_handler(\&_sentry_die_handler);
-    $main::SIG{__WARN__} = sub {
+    $SIG{__DIE__}  = \&sentry_die_handler;
+    $SIG{__WARN__} = sub {
         return if _in_eval();
         sentry_handle_error('warning', shift);
     };
index 90d9f59f73c86b5ceeada936353cf44c1f6e4b31..f93b025bfee0c29753151468ff78d89dc1d3f80d 100644 (file)
@@ -529,6 +529,9 @@ sub process {
     my $current_langs = Bugzilla->request_cache->{template_current_lang} ||= [];
     unshift(@$current_langs, $self->context->{bz_language});
     local $is_processing = 1;
+    local $SIG{__DIE__};
+    delete $SIG{__DIE__};
+    warn "WARNING: CGI::Carp makes templates slow" if $INC{"CGI/Carp.pm"};
     my $retval = $self->SUPER::process(@_);
     shift @$current_langs;
     return $retval;