summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_sys.c2
-rw-r--r--t/op/filetest_stack_ok.t8
2 files changed, 8 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 7a4c4ab1ef..b078586974 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3116,7 +3116,7 @@ S_ft_return_false(pTHX_ SV *ret) {
PUTBACK;
if (PL_op->op_private & OPpFT_STACKING) {
- while (OP_IS_FILETEST(next->op_type)
+ while (next && OP_IS_FILETEST(next->op_type)
&& next->op_private & OPpFT_STACKED)
next = next->op_next;
}
diff --git a/t/op/filetest_stack_ok.t b/t/op/filetest_stack_ok.t
index ceff452da1..36da2c8725 100644
--- a/t/op/filetest_stack_ok.t
+++ b/t/op/filetest_stack_ok.t
@@ -12,7 +12,7 @@ BEGIN {
my @ops = split //, 'rwxoRWXOezsfdlpSbctugkTMBAC';
-plan( tests => @ops * 5 );
+plan( tests => @ops * 5 + 1 );
package o { use overload '-X' => sub { 1 } }
my $o = bless [], 'o';
@@ -47,3 +47,9 @@ for my $op (@ops) {
my @foo = eval "-$op \$o";
is @foo, 1, "-$op \$overld did not leave \$overld on the stack";
}
+
+{
+ # [perl #129347] cope with stacked filetests where PL_op->op_next is null
+ () = sort { -d -d } \*TEST0, \*TEST1;
+ ok 1, "survived stacked filetests with null op_next";
+}