From 01b3578752f17209014eae7d693a93093779daac Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Thu, 7 Jul 2005 00:11:00 +0000 Subject: [PATCH] [perl #34171] bytes pragma error in substitution operator p4raw-id: //depot/perl@25088 --- pp_ctl.c | 2 +- t/op/subst.t | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index 40cf312..a0c7b08 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -204,7 +204,7 @@ PP(pp_substcont) } rxres_restore(&cx->sb_rxres, rx); - RX_MATCH_UTF8_set(rx, SvUTF8(cx->sb_targ)); + RX_MATCH_UTF8_set(rx, DO_UTF8(cx->sb_targ)); if (cx->sb_iters++) { const I32 saviters = cx->sb_iters; diff --git a/t/op/subst.t b/t/op/subst.t index 148b5db..bd481e4 100755 --- a/t/op/subst.t +++ b/t/op/subst.t @@ -7,7 +7,7 @@ BEGIN { } require './test.pl'; -plan( tests => 130 ); +plan( tests => 131 ); $x = 'foo'; $_ = "x"; @@ -539,3 +539,17 @@ my $name = "chris"; $name =~ s/hr//e; } is($name, "cis", q[#22351 bug with 'e' substitution modifier]); + + +# [perl #34171] $1 didn't honour 'use bytes' in s//e +{ + my $s="\x{100}"; + my $x; + { + use bytes; + $s=~ s/(..)/$x=$1/e + } + is(length($x), 2, '[perl #34171]'); +} + + -- 2.7.4