Skip to content

Commit 7cc7882

Browse files
committed
fixup don't UTF8-upgrade caller argument strings
1 parent 222457b commit 7cc7882

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7995,9 +7995,11 @@ PP(pp_multiparam)
79957995
val = svp ? *svp : &PL_sv_undef;
79967996
}
79977997

7998-
/* namepv / namelen are always UTF-8 */
79997998
STRLEN namelen;
8000-
const char *namepv = SvPVutf8(name, namelen);
7999+
const char *namepv = SvPV(name, namelen);
8000+
/* namepv / namelen are always UTF-8 */
8001+
if(!SvUTF8(name))
8002+
namepv = (const char *)bytes_to_utf8_temp_pv((const U8 *)namepv, &namelen);
80018003

80028004
U32 namehash;
80038005
PERL_HASH(namehash, namepv, namelen);

t/op/signatures.t

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,14 @@ is eval("tnamed07(w => 'W', x => 'X', y => 'Y', z => 'Z')"), "x=X y=Y";
988988

989989
sub tnamed09 (:$café) { return $café; }
990990
}
991-
# "café" = "caf\x{e9}"
992-
is eval('tnamed09("caf\x{e9}", "Ritz")'), "Ritz";
991+
{
992+
no utf8;
993+
994+
# "café" = "caf\x{e9}"
995+
my $nonutf8 = "caf\x{e9}";
996+
is eval('tnamed09($nonutf8, "Ritz")'), "Ritz";
997+
ok !utf8::is_utf8($nonutf8), 'Non-UTF8 parameter names do not get upgraded in caller';
998+
}
993999

9941000
# Named params in anonymous subs
9951001
{

0 commit comments

Comments
 (0)