summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-10 10:01:00 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-10 13:46:59 -0700
commitf8afbfa6f0265771da81b080f6c9fa9d7c17139b (patch)
tree19ecdb8a903cfb3d6c62680c28e85cf4b2c4fad2 /pp.h
parente5f60eac5cc3e1455d43f445ad19dc58277d8466 (diff)
downloadperl-f8afbfa6f0265771da81b080f6c9fa9d7c17139b.tar.gz
Don’t call get-magic on a referenced array in chdir, etc.
Commit 557fbd17eb added the MAYBE_DEREF_GV macro, which 2ea1cce applied to chdir, chmod and chown. That macro calls get-magic on its arguments checks to see if it might be a gv or ref and, if it’s a ref, calls get-magic on the referent, to see whether it will turn into a gv. That means we’ll end up with chdir($array_obj) calling get-magic on the array. While probably harmless, calling get-magic is superfluous and probably incorrect. I don’t know that there is a reasonable way to test this.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/pp.h b/pp.h
index b6798ead34..23636cc31e 100644
--- a/pp.h
+++ b/pp.h
@@ -510,7 +510,8 @@ True if this op will be the return value of an lvalue subroutine
SvGETMAGIC(sv), \
isGV_with_GP(sv) \
? (GV *)sv \
- : SvROK(sv) && (SvGETMAGIC(SvRV(sv)), isGV_with_GP(SvRV(sv))) \
+ : SvROK(sv) && SvTYPE(SvRV(sv)) <= SVt_PVLV && \
+ (SvGETMAGIC(SvRV(sv)), isGV_with_GP(SvRV(sv))) \
? (GV *)SvRV(sv) \
: NULL \
)