From: Jarkko Hietaniemi Date: Tue, 4 Feb 2003 11:04:25 +0000 (+0000) Subject: Fix "[perl #20667] unicode regex vs non-unicode regex". X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d12e50cf45149336efec3161d04293f1ae511ed7;p=p5sagit%2Fp5-mst-13.2.git Fix "[perl #20667] unicode regex vs non-unicode regex". The PL_regdata was not set up (S_cache_re()) before it was needed (S_reginclass()). The test put in fresh_perl.t because we need a pristine state to start. p4raw-id: //depot/perl@18653 --- diff --git a/regexec.c b/regexec.c index 59111a0..da451a8 100644 --- a/regexec.c +++ b/regexec.c @@ -856,6 +856,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, PL_regdata = prog->data; PL_bostr = startpos; } + S_cache_re(prog); s = find_byclass(prog, prog->regstclass, s, endpos, startpos, 1); if (!s) { #ifdef DEBUGGING diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t index 9c3e55c..a07396f 100644 --- a/t/run/fresh_perl.t +++ b/t/run/fresh_perl.t @@ -807,3 +807,15 @@ utf8::upgrade($_); # the original code used a UTF-8 locale (affects STDIN) # is what matters. /^([[:digit:]]+)/; EXPECT +######## [perl #20667] unicode regex vs non-unicode regex +$toto = 'Hello'; +$toto =~ /\w/; # this line provokes the problem! +$name = 'A B'; +# utf8::upgrade($name) if @ARGV; +if ($name =~ /(\p{IsUpper}) (\p{IsUpper})/){ + print "It's good! >$1< >$2<\n"; +} else { + print "It's not good...\n"; +} +EXPECT +It's good! >A< >B<