diff options
-rw-r--r-- | regcomp.c | 13 | ||||
-rw-r--r-- | t/re/pat_advanced.t | 18 |
2 files changed, 31 insertions, 0 deletions
@@ -13619,6 +13619,19 @@ parseit: "Property '%"UTF8f"' is unknown", UTF8fARG(UTF, n, name)); } + + /* If the property name doesn't already have a package + * name, add the current one to it so that it can be + * referred to outside it. [perl #121777] */ + if (! instr(name, "::") && PL_curstash) { + char* full_name = Perl_form(aTHX_ + "%s::%s", + HvNAME(PL_curstash), + name); + n = strlen(full_name); + Safefree(name); + name = savepvn(full_name, n); + } Perl_sv_catpvf(aTHX_ listsv, "%cutf8::%"UTF8f"\n", (value == 'p' ? '+' : '!'), UTF8fARG(UTF, n, name)); diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index 6990940455..40cca4128a 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -2299,6 +2299,24 @@ EOP return "!B6\n"; } + { # [perl 121777] + my $regex; + { package Some; + # define a Unicode propertyIs_q + sub Is_q + { + sprintf '%x', ord 'q' + } + $regex = qr/\p{Is_q}/; + + # If we uncomment the following line, prior to the patch that + # fixed this, it would no longer break. + #'q' =~ $regex; + } + + like('q', $regex, 'User-defined property matches outside package'); + } + { # From Lingua::Stem::UniNE; no ticket filed but related to #121778 use utf8; my $word = 'рабта'; |