From 189bafc5213ab22bb6034fb224469812bf581b20 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Fri, 26 Apr 2024 13:45:05 +0000 Subject: [PATCH] Delete the CORE/prevailing_version key from the hint hash inside string eval so perl code doesn't get to see it --- pp_ctl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index 6a1112038d5b..bee6cdbc14c2 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4077,11 +4077,18 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh) SvREFCNT_dec(GvHV(PL_hintgv)); GvHV(PL_hintgv) = hh; FETCHFEATUREBITSHH(hh); - SV *versv, **svp; - if((svp = hv_fetchs(hh, "CORE/prevailing_version", 0)) && (versv = *svp) && SvOK(versv)) { + /* temporarily turn magical flags off so we can delete without it getting in the way */ + const U32 wasflags = SvFLAGS(hh); + SvMAGICAL_off(hh); + + SV *versv; + /* hh is a new copy for us to use; we are permitted to delete keys */ + if((versv = hv_deletes(hh, "CORE/prevailing_version", 0)) && SvOK(versv)) { SAVEI16(PL_prevailing_version); PL_prevailing_version = SvUV(versv); } + + SvFLAGS(hh) = wasflags; } } SAVECOMPILEWARNINGS();