From: Father Chrysostomos Date: Sat, 4 Jun 2011 04:34:45 +0000 (-0700) Subject: [perl #88138] ' is not equivalent to :: before a null X-Git-Tag: accepted/trunk/20130322.191538~3960 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46c0ec201322d8cfdb79ed78e70ba0487858f2a9;p=platform%2Fupstream%2Fperl.git [perl #88138] ' is not equivalent to :: before a null ' 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. --- diff --git a/gv.c b/gv.c index a003adb..f8de97f 100644 --- a/gv.c +++ b/gv.c @@ -1064,9 +1064,10 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, } 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; diff --git a/t/op/stash.t b/t/op/stash.t index 1bd6c70..8132e9d 100644 --- a/t/op/stash.t +++ b/t/op/stash.t @@ -7,7 +7,7 @@ BEGIN { BEGIN { require "./test.pl"; } -plan( tests => 54 ); +plan( tests => 55 ); # Used to segfault (bug #15479) fresh_perl_like( @@ -312,3 +312,7 @@ fresh_perl_is( 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";