summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2002-11-07 01:08:11 +0530
committerJarkko Hietaniemi <jhi@iki.fi>2002-12-06 22:19:15 +0000
commit5a6f19e757e41a2b042818d845630452b9d92f16 (patch)
tree1838e8ff576a4ad8e9f82bff161fd24f08c21c18 /regcomp.c
parentd1e6c3752abd6a30afc99aa22faae6b0b0470837 (diff)
downloadperl-5a6f19e757e41a2b042818d845630452b9d92f16.tar.gz
Re: [perl #18107] lc(), uc() and ucfirst() broken inside utf8 regex
To: perl5-porters@perl.org Message-ID: <20021106193811.E20858@lustre.dyn.wiw.org> p4raw-id: //depot/maint-5.8/perl@18252
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 46884c9ed9..d01c1881e8 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5072,6 +5072,23 @@ Perl_save_re_context(pTHX)
SAVEVPTR(PL_reg_curpm); /* from regexec.c */
SAVEI32(PL_regnpar); /* () count. */
SAVEI32(PL_regsize); /* from regexec.c */
+
+ {
+ /* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */
+ int i;
+ GV *mgv;
+ REGEXP *rx;
+ char digits[16];
+
+ if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
+ for (i = 1; i <= rx->nparens; i++) {
+ sprintf(digits, "%lu", i);
+ if ((mgv = gv_fetchpv(digits, FALSE, SVt_PV)))
+ save_scalar(mgv);
+ }
+ }
+ }
+
#ifdef DEBUGGING
SAVEPPTR(PL_reg_starttry); /* from regexec.c */
#endif