From: Mike Rylander Date: Tue, 23 Feb 2016 17:32:57 +0000 (-0500) Subject: LP#1485374: Adjust TZ scope in mod_perl X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=abecff8a02343a18f00173d12970c8ed3ec3d8ef;p=working%2FEvergreen.git 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 Signed-off-by: Jason Stephenson Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 0bf86c7a20..c5b2840624 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 { @@ -269,7 +274,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/;