[harmony] Bug 1851421: Use /a with \d to ensure ASCII digit matches#169
Open
justdave wants to merge 2 commits into
Open
[harmony] Bug 1851421: Use /a with \d to ensure ASCII digit matches#169justdave wants to merge 2 commits into
justdave wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Perl 5.14 started treating Unicode variants of digits as part of the
\dcharacter class, but added a/amodifier to indicate you really only want ASCII matches. Pretty much everywhere Bugzilla uses it, we explicitly only want ASCII digits.This is a very comprehensive patch attacking every
\dregexp in Bugzilla.This patch was written by GPT-5.3-Codex, and manually reviewed by me. Most of the changes it made make sense to me (and I removed the few that didn't, which included a few minor code correctness cleanups that I liked but were out-of-scope for this patch) and it found several places I certainly would have missed had I done it manually.
It had the following to say about the changes it made:
This patch performs a broad Perl 5.14 compatibility hardening pass for regex digit handling across the Bugzilla codebase by making digit matches ASCII-explicit where needed (primarily by adding /a or using (?a:...)), so numeric IDs, dates, routes, and parser patterns no longer depend on Unicode digit semantics; the work spans core modules, CGI/scripts, extensions, and QA tests, and multiple files under extensions and qa.
This depends on #168 landing first (which is also included in this branch), and will be much easier to review after that lands and main gets merged into this PR.
Additional info
Test Plan
?? This certainly needs testing. I'm not quite sure how. A comprehensive test would be time consuming and hard to accomplish without lots of random data. If we want to do thorough testing for this it's probably better to push it off and not include it in the Bugzilla 5.9.2 release.