Re: [ID 19990808.001] [PATCH] FETCH triggered on exists()
authorRobert Spier <rspier@pobox.com>
Fri, 9 Mar 2001 03:30:20 +0000 (22:30 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 9 Mar 2001 15:01:27 +0000 (15:01 +0000)
Message-ID: <15016.38044.381174.160189@rls.cx>

EXISTS() returning undef mistakenly triggered a FETCH().

p4raw-id: //depot/perl@9090

hv.c

diff --git a/hv.c b/hv.c
index a4951f8..f25aea2 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -927,11 +927,12 @@ Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash)
 
     if (SvRMAGICAL(hv)) {
        if (mg_find((SV*)hv,'P')) {
+           SV* svret = sv_newmortal();
            sv = sv_newmortal();
            keysv = sv_2mortal(newSVsv(keysv));
            mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY);
-           magic_existspack(sv, mg_find(sv, 'p'));
-           return SvTRUE(sv);
+           magic_existspack(svret, mg_find(sv, 'p'));
+           return SvTRUE(svret);
        }
 #ifdef ENV_IS_CASELESS
        else if (mg_find((SV*)hv,'E')) {