summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-07-10 23:51:58 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-07-10 23:51:58 +0000
commit410be5dba347e0340059d489e15d034982d73278 (patch)
tree693e2b2bdd6ebf4b9c21665d58a6b92260342598 /t
parent131c565afbb207eedaa0a3a4458b1e0ef2716db7 (diff)
downloadperl-410be5dba347e0340059d489e15d034982d73278.tar.gz
Fix assertion failure on failed magic eval - eg FETCH {eval'('}
S_doeval()'s behaviour varies depending on whether the code compiles or not; on failure it pops the EVAL context block. This is bad because later on, S_docatch() assumes that the block is still there. Make docatch() return a boolean instead, indicating success. The value it formerly returned (the next op) can be deduced as PL_eval_start or PL_op->op_next on success/failure. p4raw-id: //depot/perl@31582
Diffstat (limited to 't')
-rwxr-xr-xt/op/eval.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/t/op/eval.t b/t/op/eval.t
index 7ab73ed5d6..57e39dd928 100755
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..93\n";
+print "1..94\n";
eval 'print "ok 1\n";';
@@ -458,3 +458,24 @@ print "ok $test - eval and last\n"; $test++;
print "ok $test # eval unef \n"; $test++;
}
+
+# a syntax error in an eval called magically 9eg vie tie or overload)
+# resulted in an assertion failure in S_docatch, since doeval had already
+# poppedthe EVAL context due to the failure, but S_docatch expected the
+# context to still be there.
+
+{
+ my $ok = 0;
+ package Eval1;
+ sub STORE { eval '('; $ok = 1 }
+ sub TIESCALAR { bless [] }
+
+ my $x;
+ tie $x, bless [];
+ $x = 1;
+ print "not " unless $ok;
+ print "ok $test # eval docatch \n"; $test++;
+}
+
+
+