Skip to content

Commit 99b87ad

Browse files
committed
Prepare the ICU regex translator for the REGEXP functions
The REGEXP functions need more from the translator than a text pattern: - Match bytes, for binary strings. Classes and word boundaries are the ones of PCRE, and a line ends at LF, VT, FF, and CR, like in MySQL. - Accept a look-behind only when it holds characters, sets, and "|". Older PCRE versions reject other look-behinds, so the same patterns now work with every version. - Raise WP_ICU_Regex_Exception with the MySQL error number 3690, and name the rejected syntax in the message, like "(?x" or "\10". - Write a NUL byte after a backslash as "\x00". PHP before 8.2 rejects a NUL byte in a pattern.
1 parent a1f8584 commit 99b87ad

4 files changed

Lines changed: 507 additions & 211 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
/**
4+
* Carries the MySQL error number for a regular expression failure.
5+
*
6+
* @internal
7+
*/
8+
class WP_ICU_Regex_Exception extends DomainException {
9+
}

0 commit comments

Comments
 (0)