summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-03-28 23:38:05 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-03-28 23:38:05 -0700
commitd6642e439baafa141608cfa0e6d38478f841f837 (patch)
tree0dfbd582977f42dbaf640a0d5048ea93cf52c24b /pp_sys.c
parent055745bae74336e677beadf16f2aa0f2fd3fa227 (diff)
downloadperl-d6642e439baafa141608cfa0e6d38478f841f837.tar.gz
[perl #111864] Don’t leave obj on stack for -x $overloaded
Commit 8db8f6b697e changed the way filetest operators use the stack, in order to make stacked -t work. Filetest operators were changed to pop the argument off the stack for a standalone operator, but to leave it on the stack for a stacking op (so the next operator could use it). The code for handling overloaded objects, which was separate, was already doing something similar, by not popping the object off the stack. I made the mistake of changing overloaded objects’ return code to share code with regular filetest operators (the FT_RETURN_* macros), but without changing the way the overload code got the item from the stack to begin with. Hence, the returning code assumed that the argu- ment had been popped for non-stacking ops, which was not the case. This commit changes the way the overload case does it’s return, to account for the fact that the object must be left on the stack when initially fetched from it (in case the object turns out not to have -X overloading and the regular code has to kick in).
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 49910d2985..70a026b438 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2961,10 +2961,14 @@ S_try_amagic_ftest(pTHX_ char chr) {
if (!tmpsv)
return NULL;
+ if (PL_op->op_private & OPpFT_STACKING) {
+ if (SvTRUE(tmpsv)) return NORMAL;
+ return S_ft_stacking_return_false(aTHX_ tmpsv);
+ }
+
SPAGAIN;
- if (SvTRUE(tmpsv)) FT_RETURN_TRUE(tmpsv);
- FT_RETURN_FALSE(tmpsv);
+ RETURNX(SETs(tmpsv));
}
return NULL;
}