Fix "[perl #20667] unicode regex vs non-unicode regex".
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 4 Feb 2003 11:04:25 +0000 (11:04 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 4 Feb 2003 11:04:25 +0000 (11:04 +0000)
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

regexec.c
t/run/fresh_perl.t

index 59111a0..da451a8 100644 (file)
--- 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
index 9c3e55c..a07396f 100644 (file)
@@ -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<