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
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 {
return 1;
}
-print "1..53\n";
+print "1..54\n";
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
}
ok $ok;
}
+
+# Test for bug [perl #27839]
+{
+ my $x;
+ sub f {
+ "abc" =~ /(.)./;
+ $x = "@+";
+ return @+;
+ };
+ my @y = f();
+ ok( $x eq "@y", "return a magic array ($x) vs (@y)" );
+}