summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-08-17 03:36:27 +0200
committerlpsolit%gmail.com <>2007-08-17 03:36:27 +0200
commita61497d246ff74cd33f370ec19d99abaceff7728 (patch)
tree165d234ef66cab09c66a5c94f85a5b2ba5f4b104 /Bugzilla
parent69d686de7d7f2da1c8906a5465e39eb661aa56cf (diff)
downloadbugzilla-a61497d246ff74cd33f370ec19d99abaceff7728.tar.gz
bugzilla-a61497d246ff74cd33f370ec19d99abaceff7728.tar.xz
Better fix for bug 391073: $^1 = 1 in all cases with mod_perl enabled, because everything is already evaluated, so we have to use caller() instead - Patch by me, r=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Error.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm
index d5b8a3479..18f9aae54 100644
--- a/Bugzilla/Error.pm
+++ b/Bugzilla/Error.pm
@@ -19,6 +19,7 @@
#
# Contributor(s): Bradley Baetz <bbaetz@acm.org>
# Marc Schumann <wurblzap@gmail.com>
+# Frédéric Buclin <LpSolit@gmail.com>
package Bugzilla::Error;
@@ -32,6 +33,17 @@ use Bugzilla::WebService::Constants;
use Bugzilla::Util;
use Date::Format;
+# We cannot use $^S to detect if we are in an eval(), because mod_perl
+# already eval'uates everything, so $^S = 1 in all cases under mod_perl!
+sub _in_eval {
+ my $in_eval = 0;
+ for (my $stack = 1; my $sub = (caller($stack))[3]; $stack++) {
+ last if $sub =~ /^ModPerl/;
+ $in_eval = 1 if $sub =~ /^\(eval\)/;
+ }
+ return $in_eval;
+}
+
sub _throw_error {
my ($name, $error, $vars) = @_;
@@ -43,7 +55,7 @@ sub _throw_error {
# and the transaction is rolled back (if supported)
# If we are within an eval(), do not unlock tables as we are
# eval'uating some test on purpose.
- Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT) unless $^S;
+ Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT) unless _in_eval();
my $datadir = bz_locations()->{'datadir'};
# If a writable $datadir/errorlog exists, log error details there.