Perl_re_intuit_start would set, but never unset, the RF_utf8 flag in
PL_reg_flags. This meant that two successive patterns, the first utf8 and
the sdeconfd not, that are processed using only intuit, will get the flag
wrong on the second one. The fix is trivial.
RX_MATCH_UTF8_set(rx,utf8_target);
- if (RX_UTF8(rx)) {
+ if (RX_UTF8(rx))
PL_reg_flags |= RF_utf8;
- }
+ else
+ PL_reg_flags &= ~RF_utf8;
+
DEBUG_EXECUTE_r(
debug_start_match(rx, utf8_target, strpos, strend,
sv ? "Guessing start of match in sv for"
require './test.pl';
}
-plan tests => 465; # Update this when adding/deleting tests.
+plan tests => 466; # Update this when adding/deleting tests.
run_tests() unless caller;
}
}
+ {
+ # #116148: Pattern utf8ness sticks around globally
+ # the utf8 in the first match was sticking around for the second
+ # match
+
+ use feature 'unicode_strings';
+
+ my $x = "\x{263a}";
+ $x =~ /$x/;
+
+ my $text = "Perl";
+ ok("Perl" =~ /P.*$/i, '#116148');
+ }
+
+
} # End of sub run_tests
1;