This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_goto: Call get-magic before choosing goto type
[perl5.git] / pp_ctl.c
index f889ca8..0256070 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2768,6 +2768,7 @@ PP(pp_goto)
 
     if (PL_op->op_flags & OPf_STACKED) {
        SV * const sv = POPs;
+       SvGETMAGIC(sv);
 
        /* This egregious kludge implements goto &subroutine */
        if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV) {
@@ -2951,7 +2952,7 @@ PP(pp_goto)
            }
        }
        else {
-           label       = SvPV_const(sv, label_len);
+           label       = SvPV_nomg_const(sv, label_len);
             label_flags = SvUTF8(sv);
        }
     }