diff options
author | 2011-02-03 13:37:47 -0800 | |
---|---|---|
committer | 2011-02-03 13:37:47 -0800 | |
commit | 05617ae36939d2953359ef22cf1decfea6d2f55a (patch) | |
tree | fec1f940eaa3d1c5a43538d9720d5850f6a8849c /mod_perl.pl | |
parent | Bug 461014 - How to create a private attachment in enter_bug.cgi not obvious (diff) | |
download | bugzilla-05617ae36939d2953359ef22cf1decfea6d2f55a.tar.gz bugzilla-05617ae36939d2953359ef22cf1decfea6d2f55a.tar.bz2 bugzilla-05617ae36939d2953359ef22cf1decfea6d2f55a.zip |
Bug 630750: Don't let "." and "lib" get into @INC when running under
mod_perl
r=dkl, a=mkanat
Diffstat (limited to 'mod_perl.pl')
-rw-r--r-- | mod_perl.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mod_perl.pl b/mod_perl.pl index cefe11d4c..f96156724 100644 --- a/mod_perl.pl +++ b/mod_perl.pl @@ -18,6 +18,7 @@ package Bugzilla::ModPerl; use strict; +use warnings; # This sets up our libpath without having to specify it in the mod_perl # configuration. @@ -96,6 +97,14 @@ my $rl = new ModPerl::RegistryLoader(); # Bugzilla/ModPerl/ResponseHandler.pm $rl->{package} = 'Bugzilla::ModPerl::ResponseHandler'; my $feature_files = Bugzilla::Install::Requirements::map_files_to_features(); + +# Prevent "use lib" from doing anything when the .cgi files are compiled. +# This is important to prevent the current directory from getting into +# @INC and messing things up. (See bug 630750.) +no warnings 'redefine'; +local *lib::import = sub {}; +use warnings; + foreach my $file (glob "$cgi_path/*.cgi") { my $base_filename = File::Basename::basename($file); if (my $feature = $feature_files->{$base_filename}) { @@ -117,6 +126,14 @@ sub handler : method { # here explicitly or init_page's shutdownhtml code won't work right. $0 = $ENV{'SCRIPT_FILENAME'}; + # Prevent "use lib" from modifying @INC in the case where a .cgi file + # is being automatically recompiled by mod_perl when Apache is + # running. (This happens if a file changes while Apache is already + # running.) + no warnings 'redefine'; + local *lib::import = sub {}; + use warnings; + Bugzilla::init_page(); return $class->SUPER::handler(@_); } |