summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-05 16:47:06 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-05 16:47:06 +0000
commitb9ad30b40cf004f5ea6fd7a945a950cf873aed7b (patch)
treecce3531a601494f58ec6bc8c9e674dfeea2fad51 /regexec.c
parente2560c3357339d22d0d9ac926b8e57ce241c1fb6 (diff)
downloadperl-b9ad30b40cf004f5ea6fd7a945a950cf873aed7b.tar.gz
Make Perl_pregcomp() use SvUTF8() of the pattern, rather than the flag
bit in pmflags, to decide whether the pattern is UTF-8. p4raw-id: //depot/perl@32851
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 95bba2e270..8144f998f7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3755,7 +3755,19 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
U32 pm_flags = 0;
const I32 osize = PL_regsize;
- if (DO_UTF8(ret)) pm_flags |= RXf_UTF8;
+ if (DO_UTF8(ret)) {
+ assert (SvUTF8(ret));
+ } else if (SvUTF8(ret)) {
+ /* Not doing UTF-8, despite what the SV says. Is
+ this only if we're trapped in use 'bytes'? */
+ /* Make a copy of the octet sequence, but without
+ the flag on, as the compiler now honours the
+ SvUTF8 flag on ret. */
+ STRLEN len;
+ const char *const p = SvPV(ret, len);
+ ret = newSVpvn_flags(p, len, SVs_TEMP);
+ }
+ assert(!(pm_flags & RXf_UTF8));
rx = CALLREGCOMP(ret, pm_flags);
if (!(SvFLAGS(ret)
& (SVs_TEMP | SVs_PADTMP | SVf_READONLY