From a15462528b9e274fea342c6411c762150079f453 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 23 Feb 2016 12:32:57 -0500 Subject: [PATCH] LP#1485374: Adjust TZ scope in mod_perl Use of a 'local' variable causes the TZ to be dropped prematurely. So, instead, we set $ENV{TZ} globally and reset it when the mod_perl handler object is destroyed. Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 18cde50af2..4deebcafed 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -57,6 +57,11 @@ sub new { return $self; } +sub DESTROY { + my $self = shift; + $ENV{TZ} = $self->ctx->{original_tz} + if ($self->ctx && exists $self->ctx->{original_tz}); +} # current Apache2::RequestRec; sub apache { @@ -264,7 +269,8 @@ sub load_common { $ctx->{unparsed_uri} = $self->apache->unparsed_uri; $ctx->{opac_root} = $ctx->{base_path} . "/opac"; # absolute base url - local $ENV{TZ} = $ctx->{client_tz}; + $ctx->{original_tz} = $ENV{TZ}; + $ENV{TZ} = $ctx->{client_tz}; my $xul_wrapper = ($self->apache->headers_in->get('OILS-Wrapper') || '') =~ /true/; -- 2.11.0