Closed Bug 1851421 Opened 3 years ago Closed 3 months ago

Use /a modifier on regexps that contain \d to avoid unintentional unicode matches

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
Bugzilla 5.2

People

(Reporter: justdave, Assigned: justdave)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

This is complicated. Bug Perl 5.14 (which we now require) makes this possible.

All of the good details are on bug 1136137 and you can examine the patch there for what types of things need to be done. I count 213 regexps that use \d from a quick grep. They might not all need to be touched because in many cases we can use re '/a' or similar to cover a bunch of them.

The docs for the modifiers appear to have moved since that bug though. You can now see them here

This is more likely to go in 5.2.2 than 5.2.1 because of timing but I don't have a tracking bug for that one yet.

Looks like /a also changes \w, \s, and word-boundary semantics, so we should use inline (?a:...) for regex pattern strings that also use those.

This needs to land on harmony as well.

Depends on: 2052697

Comment on attachment 9606227 [details] [review]
[bugzilla/harmony] [harmony] Bug 1851421: Use /a with \d to ensure ASCII digit matches (#169)

https://github.com/bugzilla/harmony/commit/1ece9a508d65dfe186598e90c597c3ce7805f79b

Attachment #9606227 - Flags: merged+

Comment on attachment 9600199 [details] [review]
[bugzilla/bugzilla] [5.2] Bug 1851421: Use /a with \d to ensure ASCII digit matches (#225)

https://github.com/bugzilla/bugzilla/commit/ab6f70fa938cec438a887b1111a58bab9324dbdb

Attachment #9600199 - Flags: merged+
Assignee: general → justdave
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 5.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: