summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2004-03-05 17:42:25 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-23 13:43:49 +0000
commit547d1dd82362229be47f8169355ee7b5b98dd403 (patch)
tree4fd62b41b72056a8b236a89b7182ad4602939257 /pp_hot.c
parentae3f3efdef21cd5e7aaa929b0e067c679af06832 (diff)
downloadperl-547d1dd82362229be47f8169355ee7b5b98dd403.tar.gz
Fix bug [perl #27839] returning @+ out of scope loses its value :
Subject: Re: Wondering about returned regex special arrays on going out of scope Message-Id: <200403051742.i25HgPd11240@zen.crypt.org> plus a test case. p4raw-id: //depot/perl@22564
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index f0ea5728f8..452c3a91b8 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -778,7 +778,10 @@ PP(pp_rv2av)
U32 i;
for (i=0; i < (U32)maxarg; i++) {
SV **svp = av_fetch(av, i, FALSE);
- SP[i+1] = (svp) ? *svp : &PL_sv_undef;
+ /* See note in pp_helem, and bug id #27839 */
+ SP[i+1] = svp
+ ? SvGMAGICAL(*svp) ? sv_mortalcopy(*svp) : *svp
+ : &PL_sv_undef;
}
}
else {