From: Brian Fraser Date: Tue, 13 Dec 2011 22:32:48 +0000 (-0300) Subject: pp_hot.c: First letter of latin-1 classnames wasn't being checked correctly. X-Git-Tag: accepted/trunk/20130322.191538~1725 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d47f310d69da3356f76ded4c14c2770d5f1325f4;p=platform%2Fupstream%2Fperl.git pp_hot.c: First letter of latin-1 classnames wasn't being checked correctly. Previously the first letter for latin-1 classnames was being mischecked, only allowing ASCII, which caused an instance of the Unicode Bug for downgradable classnames. --- diff --git a/pp_hot.c b/pp_hot.c index 70eb5a1..a2d6f91 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2973,7 +2973,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (!packname || ((UTF8_IS_START(*packname) && DO_UTF8(sv)) ? !isIDFIRST_utf8((U8*)packname) - : !isIDFIRST(*packname) + : !isIDFIRST_L1((U8)*packname) )) { Perl_croak(aTHX_ "Can't call method \"%"SVf"\" %s", diff --git a/t/uni/package.t b/t/uni/package.t index 317ddd4..bb9092b 100644 --- a/t/uni/package.t +++ b/t/uni/package.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan (tests => 16); +plan (tests => 18); use utf8; use open qw( :utf8 :std ); @@ -92,3 +92,20 @@ ok 1, "sanity check. If we got this far, UTF-8 in package names is legal."; eval q[package ᕘ {]; like $@, qr/\AMissing right curly /, "comp/package_block.t test"; } + +# perl #105922 + +{ + my $latin_1 = "þackage"; + my $utf8 = "þackage"; + utf8::downgrade($latin_1); + utf8::upgrade($utf8); + + local $@; + eval { $latin_1->can("yadda") }; + ok(!$@, "latin1->meth works"); + + local $@; + eval { $utf8->can("yadda") }; + ok(!$@, "utf8->meth works"); +}