' is usually equivalent to :: in a symbol name. At the *end* of a
symbol name (as in $'), it’s not equivalent. (That’s a feature.)
Perl_gv_fetchpvn_flags was checking for the end by saying
if(next character), which returns false for a null. It should be
checking the length, which it was already doing for ::, and which
this commit makes it do.
}
for (name_cursor = name; name_cursor < name_end; name_cursor++) {
- if ((*name_cursor == ':' && name_cursor < name_em1
+ if (name_cursor < name_em1 &&
+ ((*name_cursor == ':'
&& name_cursor[1] == ':')
- || (*name_cursor == '\'' && name_cursor[1]))
+ || *name_cursor == '\''))
{
if (!stash)
stash = PL_defstash;
BEGIN { require "./test.pl"; }
-plan( tests => 54 );
+plan( tests => 55 );
# Used to segfault (bug #15479)
fresh_perl_like(
ok eval { Bear::::baz() },
'packages ending with :: are self-consistent';
}
+
+# [perl #88138] ' not equivalent to :: before a null
+${"a'\0b"} = "c";
+is ${"a::\0b"}, "c", "' is equivalent to :: before a null";