summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl <khw@karl.(none)>2009-01-13 17:51:53 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-01-16 15:09:00 +0100
commit609122bd053b77225626a0b7630039ddc39620ae (patch)
treefcece1e74cb36fc2becd265192918a0be80c6419 /regcomp.c
parent8f718e95d91d8623af061685a51c710573bbb833 (diff)
downloadperl-609122bd053b77225626a0b7630039ddc39620ae.tar.gz
Add warning about octal > 377 in some regexes
(Tweaked by rgs) Message-ID: <496D3F02.6020204@khwilliamson.com>
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 3ad1f3b07d..e06152820c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -7430,6 +7430,19 @@ tryagain:
I32 flags = 0;
STRLEN numlen = 3;
ender = grok_oct(p, &numlen, &flags, NULL);
+
+ /* An octal above 0xff is interpreted differently
+ * depending on if the re is in utf8 or not. If it
+ * is in utf8, the value will be itself, otherwise
+ * it is interpreted as modulo 0x100. It has been
+ * decided to discourage the use of octal above the
+ * single-byte range. For now, warn only when
+ * it ends up modulo */
+ if (SIZE_ONLY && ender >= 0x100
+ && ! UTF && ! PL_encoding
+ && ckWARN2(WARN_DEPRECATED, WARN_REGEXP)) {
+ vWARNdep(p, "Use of octal value above 377 is deprecated");
+ }
p += numlen;
}
else {