summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c2
-rw-r--r--t/op/tie_fetch_count.t4
2 files changed, 4 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 171cb87358..e91db87adf 100644
--- a/pp.c
+++ b/pp.c
@@ -3066,7 +3066,7 @@ PP(pp_substr)
tmps = SvPV_force_nomg(sv, curlen);
if (DO_UTF8(repl_sv) && repl_len) {
if (!DO_UTF8(sv)) {
- sv_utf8_upgrade(sv);
+ sv_utf8_upgrade_nomg(sv);
curlen = SvCUR(sv);
}
}
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t
index b5e4f90556..240d23aef3 100644
--- a/t/op/tie_fetch_count.t
+++ b/t/op/tie_fetch_count.t
@@ -7,7 +7,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 311);
+ plan (tests => 312);
}
use strict;
@@ -262,6 +262,8 @@ $dummy = $$l ; check_count 'reading lvalue substr($utf8)';
$$l = 0 ; check_count 'setting lvalue substr($utf8)';
tie $var, "main", "a";
$$l = "\x{100}" ; check_count 'assigning $utf8 to lvalue substr';
+tie $var1, "main", "a";
+substr$var1,0,0,"\x{100}"; check_count '4-arg substr with utf8 replacement';
{
local $SIG{__WARN__} = sub {};