summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDan Collins <dcollinsn@gmail.com>2016-03-30 16:42:39 +1100
committerRicardo Signes <rjbs@cpan.org>2016-04-07 07:45:08 -0400
commit8f6eb0aa5efb953e32803878cca6d9c1e28ac03f (patch)
tree28c475d036a9b1023371f30dd05f705ce46b4fd1 /op.c
parent45d40326f89400e722587fa76ee587404ef594f9 (diff)
downloadperl-8f6eb0aa5efb953e32803878cca6d9c1e28ac03f.tar.gz
(perl #126162) warn if stat() is called on an array
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/op.c b/op.c
index e58f711499..9bbe4f31cc 100644
--- a/op.c
+++ b/op.c
@@ -9733,6 +9733,10 @@ Perl_ck_ftst(pTHX_ OP *o)
op_free(o);
return newop;
}
+
+ if (kidtype == OP_RV2AV) {
+ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "Array passed to stat will be coerced to a scalar (did you want stat $_[0]?)");
+ }
scalar((OP *) kid);
if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o->op_type))
o->op_private |= OPpFT_ACCESS;