This comparison in toke.c checks whether the charnames translators is
the core’s own and, if so, skips certain validation checks.
Charnames translators coming from any package beginning with
"_charnames\0" would also be exempt from the checks, because the name
comparison stopped at the first null.
like ($@, qr/Trailing white-space in a charnames alias definition is deprecated/, "... same under utf8");
}
+ {
+ BEGIN { no strict; *CnameTest:: = *{"_charnames\0A::" } }
+ package CnameTest { sub translator { pop } }
+ BEGIN { $^H{charnames} = \&CnameTest::translator }
+ undef $w;
+ () = eval q ["\N{TOO MANY SPACES}"];
+ like ($w, qr/A sequence of multiple spaces/,
+ 'translators in _charnames\0* packages get validated');
+ }
+
# If remove the limitation in regcomp code these should work
# differently
undef $w;
SvTYPE(rv) == SVt_PVCV) && ((stash = CvSTASH(rv)) != NULL))
{
const char * const name = HvNAME(stash);
- if strEQ(name, "_charnames") {
+ if (HvNAMELEN(stash) == sizeof("_charnames")-1
+ && strEQ(name, "_charnames")) {
return res;
}
}