From: Adrian M. Enache Date: Fri, 21 Feb 2003 17:49:41 +0000 (+0200) Subject: [perl #20684] [fix] s/// with (??{..}) inside returns wrong count X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=22e13caa16a0052ac27896caeb4c33581f86e239;p=p5sagit%2Fp5-mst-13.2.git [perl #20684] [fix] s/// with (??{..}) inside returns wrong count Message-ID: <20030221154941.GA793@ratsnest.hole> p4raw-id: //depot/perl@18775 --- diff --git a/pp_ctl.c b/pp_ctl.c index cdcbb30..1528168 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -204,7 +204,7 @@ PP(pp_substcont) sv_free(dstr); TAINT_IF(cx->sb_rxtainted & 1); - PUSHs(sv_2mortal(newSViv((I32)cx->sb_iters - 1))); + PUSHs(sv_2mortal(newSViv(saviters - 1))); (void)SvPOK_only_UTF8(targ); TAINT_IF(cx->sb_rxtainted); diff --git a/t/op/subst.t b/t/op/subst.t index 59c3d21..689b74f 100755 --- a/t/op/subst.t +++ b/t/op/subst.t @@ -7,7 +7,7 @@ BEGIN { } require './test.pl'; -plan( tests => 126 ); +plan( tests => 127 ); $x = 'foo'; $_ = "x"; @@ -516,3 +516,8 @@ is("<$_> <$s>", "<> <4>", "[perl #7806]"); $f =~ s/x/y/g; is($f, "yy", "[perl #17757]"); } + +# [perl #20684] returned a zero count +$_ = "1111"; +is(s/(??{1})/2/eg, 4, '#20684 s/// with (??{..}) inside'); +