summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c3
-rw-r--r--regexec.c5
-rwxr-xr-xt/pragma/utf8.t12
3 files changed, 15 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index 2d49cf15c6..784c7bf4b1 100644
--- a/pp.c
+++ b/pp.c
@@ -5873,7 +5873,8 @@ PP(pp_split)
s = m;
}
}
- else if ((rx->reganch & RE_USE_INTUIT) && !rx->nparens
+ else if (do_utf8 == ((rx->reganch & ROPT_UTF8) != 0) &&
+ (rx->reganch & RE_USE_INTUIT) && !rx->nparens
&& (rx->reganch & ROPT_CHECK_ALL)
&& !(rx->reganch & ROPT_ANCH)) {
int tail = (rx->reganch & RE_INTUIT_TAIL);
diff --git a/regexec.c b/regexec.c
index dca2a44be6..e85f45f4ed 100644
--- a/regexec.c
+++ b/regexec.c
@@ -443,8 +443,6 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
#endif
restart:
- other_last = Nullch;
-
/* Find a possible match in the region s..strend by looking for
the "check" substring in the region corrected by start/end_shift. */
if (flags & REXEC_SCREAM) {
@@ -1462,7 +1460,8 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char *
PL_reg_ganch = strbeg;
}
- if (!(flags & REXEC_CHECKED) && prog->check_substr != Nullsv) {
+ if (do_utf8 == (UTF!=0) &&
+ !(flags & REXEC_CHECKED) && prog->check_substr != Nullsv) {
re_scream_pos_data d;
d.scream_olds = &scream_olds;
diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t
index 8e4d296f5d..9137f3606b 100755
--- a/t/pragma/utf8.t
+++ b/t/pragma/utf8.t
@@ -10,7 +10,7 @@ BEGIN {
}
}
-print "1..105\n";
+print "1..106\n";
my $test = 1;
@@ -554,3 +554,13 @@ sub nok_bytes {
print "ok $test\n";
$test++; # 105
}
+
+{
+ use utf8;
+
+ my @a = split(/\xFE/, "\xFF\xFE\xFD");
+
+ print "not " unless @a == 2 && $a[0] eq "\xFF" && $a[1] eq "\xFD";
+ print "ok $test\n";
+ $test++; # 106
+}