This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ch(dir|mod|own) should not ignore get-magic on glob(ref)s
[perl5.git] / pp_sys.c
index ccc4325..8666a91 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3466,14 +3466,14 @@ PP(pp_chdir)
        if (PL_op->op_flags & OPf_SPECIAL) {
            gv = gv_fetchsv(sv, 0, SVt_PVIO);
        }
-        else if (isGV_with_GP(sv)) {
+        else if (SvGETMAGIC(sv), isGV_with_GP(sv)) {
            gv = MUTABLE_GV(sv);
         }
        else if (SvROK(sv) && isGV_with_GP(SvRV(sv))) {
             gv = MUTABLE_GV(SvRV(sv));
         }
         else {
-           tmps = SvPV_nolen_const(sv);
+           tmps = SvPV_nomg_const_nolen(sv);
        }
     }