Change 32761 by [EMAIL PROTECTED] on 2007/12/29 13:26:35
Fix Perl #49190, tests from Abigail, codefix from me.
Affected files ...
... //depot/perl/pp_hot.c#539 edit
... //depot/perl/t/op/pat.t#300 edit
Differences ...
==== //depot/perl/pp_hot.c#539 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#538~32753~ 2007-12-28 13:25:50.000000000 -0800
+++ perl/pp_hot.c 2007-12-29 05:26:35.000000000 -0800
@@ -2035,6 +2035,7 @@
const I32 oldsave = PL_savestack_ix;
STRLEN slen;
bool doutf8 = FALSE;
+ I32 matched;
#ifdef PERL_OLD_COPY_ON_WRITE
bool is_cow;
#endif
@@ -2121,7 +2122,8 @@
/* only replace once? */
once = !(rpm->op_pmflags & PMf_GLOBAL);
-
+ matched = CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL,
+ r_flags | REXEC_CHECKED);
/* known replacement string? */
if (dstr) {
/* replacement needing upgrading? */
@@ -2153,8 +2155,7 @@
&& (I32)clen <= rx->minlenret && (once || !(r_flags & REXEC_COPY_STR))
&& !(rx->extflags & RXf_LOOKBEHIND_SEEN)
&& (!doutf8 || SvUTF8(TARG))) {
- if (!CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL,
- r_flags | REXEC_CHECKED))
+ if (!matched)
{
SPAGAIN;
PUSHs(&PL_sv_no);
@@ -2258,8 +2259,7 @@
RETURN;
}
- if (CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL,
- r_flags | REXEC_CHECKED))
+ if (matched)
{
if (force_on_match) {
force_on_match = 0;
==== //depot/perl/t/op/pat.t#300 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#299~32749~ 2007-12-27 15:28:31.000000000 -0800
+++ perl/t/op/pat.t 2007-12-29 05:26:35.000000000 -0800
@@ -4511,13 +4511,20 @@
}
}
}
-
{
my $a = 3; "" =~ /(??{ $a })/;
my $b = $a;
iseq($b, $a, "copy of scalar used for postponed subexpression");
}
-
+{
+ local $Message = "\$REGMARK in replacement -- Bug #49190";
+ my $_ = "A";
+ s/(*:B)A/$REGMARK/;
+ iseq $_, "B";
+ $_ = "CCCCBAA";
+ s/(*:X)A+|(*:Y)B+|(*:Z)C+/$REGMARK/g;
+ iseq $_, "ZYX";
+}
# Test counter is at bottom of file. Put new tests above here.
#-------------------------------------------------------------------
# Keep the following tests last -- they may crash perl
@@ -4576,6 +4583,6 @@
iseq(0+$::test,$::TestCount,"Got the right number of tests!");
# Don't forget to update this!
BEGIN {
- $::TestCount = 4014;
+ $::TestCount = 4016;
print "1..$::TestCount\n";
}
End of Patch.