diff --git a/packages/mysql-on-sqlite/src/sqlite/class-wp-sqlite-pdo-user-defined-functions.php b/packages/mysql-on-sqlite/src/sqlite/class-wp-sqlite-pdo-user-defined-functions.php index 91b40dea6..6f5c9c65a 100644 --- a/packages/mysql-on-sqlite/src/sqlite/class-wp-sqlite-pdo-user-defined-functions.php +++ b/packages/mysql-on-sqlite/src/sqlite/class-wp-sqlite-pdo-user-defined-functions.php @@ -108,6 +108,89 @@ public static function register_for( $pdo ): self { 'regexp_instr' => array( 2, 3, 4, 5, 6 ), ); + /** + * ICU escapes of a code point that PCRE lacks or reads differently: "\uhhhh", + * "\Uhhhhhhhh", "\0ooo" up to "\0377", and "\cX". A surrogate pair of "\u" escapes + * is one code point. ICU's "\cX" keeps the low 5 bits of X, where PCRE flips a bit. + * "\xh" and "\xhh" are here too, as a translation can put a hex digit after them, + * like in "[\x4[5]]". + */ + private const REGEXP_CODE_POINT_ESCAPE = '\\\\u[dD][89abAB][0-9a-fA-F]{2}\\\\u[dD][c-fC-F][0-9a-fA-F]{2}|\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}|\\\\0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)|\\\\x[0-9a-fA-F]{1,2}|\\\\c(?:[\xC0-\xFF][\x80-\xBF]*+|[\s\S])'; + + /** + * Letters that ICU reads literally after a backslash, outside of a set. PCRE rejects + * most of them, and reads some differently, like "\K". + */ + private const REGEXP_LITERAL_ESCAPES = 'gijlmoqyCEFIJKLMOTY'; + + /** + * Letters that ICU reads literally after a backslash, in a set. PCRE rejects most of + * them, and reads some differently, like "\b". + */ + private const REGEXP_LITERAL_SET_ESCAPES = 'bgijklmoqyzABCEFGIJKLMORTXYZ'; + + /** + * ICU's word characters: alphabetic ones, marks, decimal digits, connector punctuation, + * and the zero-width joiners. Alphabetic characters are letters, letter numbers, and + * letters in circles or squares, like "Ⓐ". PCRE's "\w" misses some marks, and it + * matches other numbers, like "²". + */ + private const REGEXP_WORD_CLASS = '\p{L}\p{Nl}\p{M}\p{Nd}\p{Pc}\x{200C}\x{200D}\x{24B6}-\x{24E9}\x{1F130}-\x{1F149}\x{1F150}-\x{1F169}\x{1F170}-\x{1F189}'; + + /** + * General categories by their long names and aliases, as ICU matches them: in + * lowercase, without spaces, hyphens, and underscores. PCRE has only short names, + * and before PCRE2 10.40, not "LC". + */ + private const REGEXP_GENERAL_CATEGORIES = array( + 'other' => 'C', + 'control' => 'Cc', + 'cntrl' => 'Cc', + 'format' => 'Cf', + 'unassigned' => 'Cn', + 'privateuse' => 'Co', + 'surrogate' => 'Cs', + 'letter' => 'L', + 'casedletter' => 'L&', + 'lc' => 'L&', + 'lowercaseletter' => 'Ll', + 'modifierletter' => 'Lm', + 'otherletter' => 'Lo', + 'titlecaseletter' => 'Lt', + 'uppercaseletter' => 'Lu', + 'mark' => 'M', + 'combiningmark' => 'M', + 'spacingmark' => 'Mc', + 'enclosingmark' => 'Me', + 'nonspacingmark' => 'Mn', + 'number' => 'N', + 'decimalnumber' => 'Nd', + 'digit' => 'Nd', + 'letternumber' => 'Nl', + 'othernumber' => 'No', + 'punctuation' => 'P', + 'punct' => 'P', + 'connectorpunctuation' => 'Pc', + 'dashpunctuation' => 'Pd', + 'closepunctuation' => 'Pe', + 'finalpunctuation' => 'Pf', + 'initialpunctuation' => 'Pi', + 'otherpunctuation' => 'Po', + 'openpunctuation' => 'Ps', + 'symbol' => 'S', + 'currencysymbol' => 'Sc', + 'modifiersymbol' => 'Sk', + 'mathsymbol' => 'Sm', + 'othersymbol' => 'So', + 'separator' => 'Z', + 'lineseparator' => 'Zl', + 'paragraphseparator' => 'Zp', + 'spaceseparator' => 'Zs', + ); + + /** The POSIX classes of PCRE. */ + private const REGEXP_POSIX_CLASSES = array( 'alnum', 'alpha', 'ascii', 'blank', 'cntrl', 'digit', 'graph', 'lower', 'print', 'punct', 'space', 'upper', 'word', 'xdigit' ); + /** @var string[] Compiled PCRE patterns, keyed by byte mode, "\G" variant, match type, and pattern. */ private $regexp_cache = array(); @@ -1238,15 +1321,30 @@ private function regexp_check_match_type( $function_name, $match_type ) { * (UTF-8) modifier is applied unless byte-oriented matching is requested. * Case-insensitive is the default. * - * MySQL uses ICU, which differs from PCRE in some syntax, like ICU-only escapes - * and nested sets. The known failures of the REGEXP test suites list these - * cases. Other known differences: + * MySQL uses ICU, which differs from PCRE in some syntax, like `\N{...}`, Unicode + * blocks, and Java properties. The known failures of the REGEXP test suites list + * these cases. Other known differences: * * - Text matching ignores case unless the `c` flag is passed, as the column * collation isn't known here. * - PCRE doesn't match "ß" with "ss" when ignoring case, `$` also matches * between CR and LF, and `(?P...)` is valid. + * - Inline case flags don't change `[:upper:]` and `[:lower:]`, or `\p{Lu}` and + * `\p{Ll}` on PCRE 10.44 and older: `(?i)[[:upper:]]` with the `c` flag keeps + * their case, and a `(?-i)` keeps it in the whole pattern. + * - When ignoring case, `[:upper:]`, `[:lower:]`, `\p{Lu}`, and `\p{Ll}` also match + * letters like "ĸ" or "ℓ", which have no other case. ICU leaves them out. + * - When ignoring case, ICU applies it to a set after the set's operations, so + * `[A-Za-z--aeiou]` matches "a", as "A" stays in the set. Here, the operation + * removes both cases. Operands in brackets, like `[a-z--[aeiou]]`, match ICU. + * - ICU attaches a combining mark to the character before it, so a mark after a + * space doesn't start a word for `\b`. Here, it does. * - `\G` in a lookbehind doesn't always match where it does in ICU. + * - MySQL 5.7's word boundaries, `[[:<:]]` and `[[:>:]]`, work, where MySQL 8 + * rejects them. + * - A `#` comment of the `x` flag is translated like the rest of the pattern, so + * an invalid set or a repeated `\b` in it is an error, and a `\Q` in it quotes + * the text after it. * - Data that isn't valid UTF-8 is matched byte by byte and case-sensitively, * like MySQL binary strings. Other binary values match as text, so case * sensitivity, and whether positions count bytes, can differ between rows. @@ -1256,6 +1354,8 @@ private function regexp_check_match_type( $function_name, $match_type ) { * `2.6` means 2 (MySQL: 3), and `'2e1'` means 20 (MySQL: 2). * - A repeated group, like `(a|b)*`, can exceed PCRE's limits on a subject of * about 50,000 characters, or 2,000 on PHP 7.2. + * - `\w` and `\b` become long classes, so a repeated group like + * `(?:\b\w+\b\W*){1,100}` can be too large to compile. * * @param string $pattern The MySQL regex pattern. * @param string $match_type MySQL match_type flag string. @@ -1301,9 +1401,8 @@ private function regexp_compile( $pattern, $match_type, $binary_mode = false, $w } /* - * PHP 7 can read an unknown escape as literal text. For "\y", that matches ICU, - * but "\u0041" matches "u0041", where ICU matches "A". The "X" modifier makes - * all of them errors, like in PHP 8. + * PHP 7 can read an unknown escape, like "\u004", as literal text. The "X" modifier + * makes it an error, like in ICU and PHP 8. */ $modifiers = $binary_mode ? 'X' : 'uX'; if ( ! $case_sensitive ) { @@ -1328,7 +1427,7 @@ private function regexp_compile( $pattern, $match_type, $binary_mode = false, $w } else { $newline = '(*ANY)'; } - $compiled = '/' . $newline . $this->regexp_escape_pattern( $pattern, $without_g ) . '/' . $modifiers; + $compiled = '/' . $newline . $this->regexp_translate_pattern( $pattern, ! $case_sensitive, $binary_mode, $without_g ) . '/' . $modifiers; /* * Compile the pattern by matching it against an empty string. Only a compile @@ -1353,68 +1452,419 @@ private function regexp_compile( $pattern, $match_type, $binary_mode = false, $w } /** - * Escape pattern delimiters and NUL bytes that are not already escaped, read - * "\K" as "K", and, if asked, make "\G" never match. + * Translate a MySQL regex pattern to PCRE syntax. * - * PHP before 8.2 rejects NUL bytes in patterns, so they become "\x00". + * Splits the pattern into quoted text, comments, sets, escapes, POSIX classes, and + * other characters, so that a translation applies only to a whole token. * - * @param string $pattern The regex pattern. - * @param bool $without_g Optional. Whether "\G" never matches. + * @param string $pattern The regex pattern. + * @param bool $case_insensitive Whether the pattern ignores case by default. + * @param bool $binary_mode Whether the pattern matches bytes instead of UTF-8 characters. + * @param bool $without_g Whether "\G" never matches. * + * @throws Exception If the pattern can't be split, or it has an invalid set, a + * comment without an end, or a repeated word boundary. * @return string Pattern safe to wrap in slash delimiters. */ - private function regexp_escape_pattern( $pattern, $without_g = false ) { - $special = array( - '/' => '\\/', - "\0" => '\\x00', + private function regexp_translate_pattern( $pattern, $case_insensitive, $binary_mode, $without_g ) { + $tokens = array( + // The delimiter, and NUL bytes, which PHP before 8.2 rejects in patterns. + '/' => '\\/', + "\0" => '\\x00', + "\\\0" => '\\x00', + + // PCRE's [:punct:] also holds ASCII symbols like "+", where ICU's doesn't. + '[:punct:]' => '\\p{P}', + '[:^punct:]' => '\\P{P}', + + // MySQL 5.7's word boundaries go to PCRE, which supports them, as older patterns + // use them. + '[[:<:]]' => '[[:<:]]', + '[[:>:]]' => '[[:>:]]', ); + if ( $without_g ) { + // "\b\B" never matches, as no position is both a word boundary and not one. + $tokens['\\G'] = '\\b\\B'; + } + + // "\w", "\b", and [:word:] use ICU's word characters, except on bytes. + if ( ! $binary_mode ) { + $word = self::REGEXP_WORD_CLASS; + $tokens += array( + '\\w' => "[$word]", + '\\W' => "[^$word]", + '\\b' => "(?:(?<=[$word])(?![$word])|(? "(?:(?<=[$word])(?=[$word])|(? $word, + '[:^word:]' => "[^$word]", + ); + } /* - * ICU reads "\K" as "K". In PCRE, "\K" moves the start of the match, even to - * before the place where the search started, like in "(?<=\Ka)". + * With the "u" modifier, PCRE reads [:upper:] and [:lower:] case-sensitively + * even when the pattern ignores case, where ICU matches both cases. PCRE 10.44 + * and older read \p{Lu} and \p{Ll} the same way. \p{L&} would ignore "(?-i)", so + * a pattern with it keeps PCRE's classes. */ - $escapes = $special + array( 'K' => 'K' ); - if ( $without_g ) { - // A position can't be both a word boundary and not one, so "\b\B" never - // matches. Unlike "(?!)", it has no ")" to end a "(?#...)" comment. - $escapes['G'] = '\\b\\B'; - } - - $escaped = ''; - $quoted = false; - $length = strlen( $pattern ); - for ( $i = 0; $i < $length; ++$i ) { - $character = $pattern[ $i ]; - if ( $quoted ) { - if ( '\\' === $character && $i + 1 < $length && 'E' === $pattern[ $i + 1 ] ) { - $escaped .= '\\E'; - $quoted = false; - ++$i; - } elseif ( isset( $special[ $character ] ) ) { - $escaped .= '\\E' . $special[ $character ] . '\\Q'; + if ( $case_insensitive && ! preg_match( '/\(\?[a-zA-Z]*-[a-zA-Z]*i/', $pattern ) ) { + $tokens += array( + '[:upper:]' => '\\p{L&}', + '[:^upper:]' => '\\P{L&}', + '[:lower:]' => '\\p{L&}', + '[:^lower:]' => '\\P{L&}', + '\\p{Lu}' => '\\p{L&}', + '\\P{Lu}' => '\\P{L&}', + '\\p{Ll}' => '\\p{L&}', + '\\P{Ll}' => '\\P{L&}', + ); + } + + /* + * A "(?#...)" comment is one token, so that no translation changes it. Like in + * ICU, a "\Q" in it quotes the text up to "\E", which can hold its ")", but "\\Q" + * is an escaped backslash and a "Q". + * + * A set, with its nested sets, is one token, as ICU's sets differ from PCRE's. + * Like ICU, "[:" starts a POSIX class if the next ":" is followed by "]", and a + * set otherwise. ICU reads a POSIX class outside of a set, as in "[:alpha:]", as + * a set. The set's loops and its leading "^" and "]" are possessive, so that a + * long set doesn't exhaust PCRE's stack, and the "]" of "[]" or "[^]" can't end + * the set. In a set, a control escape, like "\c]", takes the next character. + * + * A property name stops at a backslash, so that a long run of "\p{" doesn't + * scan the rest of the pattern each time. A "\b" or "\B" with a quantifier or + * "{" after it is one token, so that it is an error, like in ICU. + */ + $translated = preg_replace_callback( + '/\\\\Q.*?(?:\\\\E|\z)|\(\?#(?:\\\\Q.*?(?:\\\\E|\z)|\\\\[^)]|[^)])*+\)|\(\?#|\[:\^?[^:]*:\]|(\[\^?+\]?+(?:\\\\Q.*?(?:\\\\E|\z)|\\\\c.|\\\\.|\[:\^?[^:]*:\]|(?1)|[^\\\\\[\]])*+\])|' . self::REGEXP_CODE_POINT_ESCAPE . '|\\\\[pP]\{[^}\\\\]*\}|\\\\[bB][*+?{]|\\\\.|[\/\0]/s', + function ( $parts ) use ( $pattern, $tokens ) { + $token = $parts[0]; + if ( isset( $parts[1] ) ) { + return $tokens[ $token ] ?? $this->regexp_translate_set( $token, $pattern, $tokens ); + } + if ( '(?#' === $token ) { + // The comment has no end, as its ")" is missing or quoted. + throw new Exception( "Invalid regular expression: $pattern." ); + } + if ( '(' === $token[0] ) { + return '(?#)'; + } + if ( '[' === $token[0] ) { + return $this->regexp_set_fragment( $this->regexp_translate_property( $token, $tokens ) ); + } + if ( isset( $token[2] ) && ( 'b' === $token[1] || 'B' === $token[1] ) ) { + throw new Exception( "Invalid regular expression: $pattern." ); + } + return $this->regexp_translate_token( $token, $tokens ); + }, + $pattern + ); + + // Long quoted text can hit PCRE's backtrack limit, and an empty pattern would match + // everything. + if ( null === $translated ) { + $this->regexp_fail( $pattern ); + } + return $translated; + } + + /** + * Translate an ICU set, like "[a-z--[aeiou]]", to PCRE. + * + * ICU sets can nest, and they have operations that PCRE classes lack. "--" and "&&" + * subtract or intersect the items up to the next of them. A single "-" or "&" between + * two sets applies the second set to all the items before it, back to the start or + * the last "--" or "&&". Class escapes and properties right after the second set + * join it. Elsewhere, "-" and "&" are literal, unless "-" makes a range. A set + * without operations stays a PCRE class, and the others become lookaheads, like + * "(?:(?![aeiou])[a-z])". + * + * @param string $set The set, with its brackets. + * @param string $pattern The regex pattern, for error messages. + * @param string[] $tokens Translations of tokens. + * + * @throws Exception If ICU rejects the set. + * @return string The PCRE equivalent, which matches one character. + */ + private function regexp_translate_set( $set, $pattern, $tokens ) { + // An escape with its argument is one token, and so is a character, also when the + // set isn't valid UTF-8. + preg_match_all( + '/\\\\Q.*?(?:\\\\E|\z)|' . self::REGEXP_CODE_POINT_ESCAPE . '|\\\\(?:[pP](?:\{[^}\\\\]*\}|\w)|[xN]\{[^}\\\\]*\}|.)|\[:\^?[^:]*:\]|\[\^?|&&|--|[\xC0-\xFF][\x80-\xBF]*|./s', + $set, + $parts + ); + + // ICU reads quoted text one character at a time, so a quoted character can end a + // range and start the next one, and empty quotes leave nothing. + $characters = array(); + foreach ( $parts[0] as $part ) { + if ( '\\Q' !== substr( $part, 0, 2 ) ) { + $characters[] = $part; + continue; + } + preg_match_all( '/[\xC0-\xFF][\x80-\xBF]*|./s', substr( $part, 2, -2 ), $quoted ); + foreach ( $quoted[0] as $character ) { + $characters[] = '\\Q' . $character . '\\E'; + } + } + $position = 0; + return $this->regexp_set_fragment( $this->regexp_parse_set( $characters, $position, $pattern, $tokens ) ); + } + + /** + * Parse an ICU set from its tokens. + * + * @param string[] $parts The tokens of the set. + * @param int $position The position of the set's "[" or "[^", moved past its "]". + * @param string $pattern The regex pattern, for error messages. + * @param string[] $tokens Translations of tokens. + * + * @throws Exception If ICU rejects the set. + * @return array The set, as array( PCRE class body or fragment, whether it's a class body ). + */ + private function regexp_parse_set( array $parts, &$position, $pattern, $tokens ) { + // An escape is translated, and another character is escaped if PCRE needs it. + $literal = function ( $part ) use ( $tokens ) { + return '\\' === $part[0] ? $this->regexp_translate_token( $part, $tokens, true ) : ( $tokens[ $part ] ?? preg_quote( $part ) ); + }; + + $negated = '[^' === $parts[ $position++ ]; + $result = null; + $operator = null; + $terms = array(); + $type = null; // The kind of the last term. + $pending = null; // A single "-" or "&" to apply, with the items before it. + for ( $first = true; ; $first = false ) { + $part = $parts[ $position++ ] ?? null; + $next = $parts[ $position ] ?? ''; + + // Like in ICU, class escapes and properties right after the second set of a + // single "-" or "&" join that set. Anything else applies the operation first. + if ( $pending && ! preg_match( '/^\\\\[pPdDsSwWhHvV]/', (string) $part ) ) { + $terms = array( $this->regexp_set_operation( $pending[0], $pending[1], $this->regexp_set_union( $terms ) ) ); + $pending = null; + } + + // ICU reads "]" right after "[" or "[^" literally. + if ( null === $part || ( ']' === $part && ! $first ) ) { + if ( null === $part || ! $terms ) { + throw new Exception( "Invalid regular expression: $pattern." ); + } + break; + } + if ( '--' === $part || '&&' === $part ) { + if ( ! $terms ) { + throw new Exception( "Invalid regular expression: $pattern." ); + } + $right = $this->regexp_set_union( $terms ); + $result = null === $result ? $right : $this->regexp_set_operation( $result, $operator, $right ); + $operator = $part; + $terms = array(); + $type = null; + continue; + } + + // A single "-" or "&" between two sets applies to all the items before it. + if ( ( '-' === $part || '&' === $part ) && 'set' === $type && '[' === substr( $next, 0, 1 ) ) { + if ( '[:' === substr( $next, 0, 2 ) ) { + $right = $this->regexp_translate_property( $next, $tokens ); + ++$position; } else { - $escaped .= $character; + $right = $this->regexp_parse_set( $parts, $position, $pattern, $tokens ); + } + $pending = array( $this->regexp_set_union( $terms ), '-' === $part ? '--' : '&&' ); + $terms = array( $right ); + continue; + } + + // A "-" between two characters makes a range. A class escape or a property + // can't end it. + if ( '-' === $part && 'literal' === $type && ! in_array( $next, array( '', ']', '--', '&&' ), true ) && '[' !== $next[0] ) { + if ( preg_match( '/^\\\\[pPdDsSwWhHvV]/', $next ) ) { + throw new Exception( "Invalid regular expression: $pattern." ); } + $last = count( $terms ) - 1; + $terms[ $last ] = array( $terms[ $last ][0] . '-' . $literal( $next ), true ); + $type = 'range'; + ++$position; continue; } - if ( '\\' === $character && $i + 1 < $length ) { - $next = $pattern[ $i + 1 ]; - $escaped .= isset( $escapes[ $next ] ) ? $escapes[ $next ] : $character . $next; - $quoted = 'Q' === $next; - ++$i; - } elseif ( isset( $special[ $character ] ) ) { - $escaped .= $special[ $character ]; + + if ( '[' === $part[0] && '[:' !== substr( $part, 0, 2 ) ) { + --$position; + $terms[] = $this->regexp_parse_set( $parts, $position, $pattern, $tokens ); + $type = 'set'; + } elseif ( preg_match( '/^(?:\[:|\\\\[pP])/', $part ) ) { + $terms[] = $this->regexp_translate_property( $part, $tokens ); + $type = 'set'; + } elseif ( preg_match( '/^\\\\[dDsSwWhHvV]$/', $part ) ) { + // A translated class, like "[\p{L}...]", joins the set, and a negated one is an alternative. + $class = $tokens[ $part ] ?? $part; + $terms[] = '[^' === substr( $class, 0, 2 ) ? array( $class, false ) : array( trim( $class, '[]' ), true ); + $type = 'escape'; } else { - $escaped .= $character; + $terms[] = array( $literal( $part ), true ); + $type = 'literal'; } } - // Close quoted text that runs to the end, so that a trailing backslash - // can't escape the delimiter. - if ( $quoted ) { - $escaped .= '\\E'; + $right = $this->regexp_set_union( $terms ); + $set = null === $result ? $right : $this->regexp_set_operation( $result, $operator, $right ); + if ( ! $negated ) { + return $set; + } + return array( $set[1] ? '[^' . $set[0] . ']' : '(?:(?!' . $set[0] . ')[\\s\\S])', false ); + } + + /** + * Join the terms of a set into one class, or into alternatives if a term isn't a class. + * + * @param array[] $terms The terms, as returned by regexp_parse_set(). + * + * @return array The union, as array( PCRE class body or fragment, whether it's a class body ). + */ + private function regexp_set_union( array $terms ) { + $body = ''; + $alternatives = array(); + foreach ( $terms as $term ) { + if ( $term[1] ) { + $body .= $term[0]; + } else { + $alternatives[] = $term[0]; + } + } + if ( ! $alternatives ) { + return array( $body, true ); + } + if ( '' !== $body ) { + array_unshift( $alternatives, "[$body]" ); + } + return array( '(?:' . implode( '|', $alternatives ) . ')', false ); + } + + /** + * Subtract or intersect two sets. + * + * @param array $left The left set, as returned by regexp_parse_set(). + * @param string $operator "--" or "&&". + * @param array $right The right set. + * + * @return array The result, as a PCRE fragment. + */ + private function regexp_set_operation( array $left, $operator, array $right ) { + $assertion = '--' === $operator ? '(?!' : '(?='; + return array( '(?:' . $assertion . $this->regexp_set_fragment( $right ) . ')' . $this->regexp_set_fragment( $left ) . ')', false ); + } + + /** + * Get the PCRE fragment of a set. + * + * @param array $set The set, as returned by regexp_parse_set(). + * + * @return string The PCRE fragment, which matches one character. + */ + private function regexp_set_fragment( array $set ) { + return $set[1] ? "[{$set[0]}]" : $set[0]; + } + + /** + * Translate a token of a pattern. + * + * @param string $token The token. + * @param string[] $tokens Translations of tokens. + * @param bool $in_set Whether the token is in a set. + * + * @return string The PCRE equivalent. + */ + private function regexp_translate_token( $token, $tokens, $in_set = false ) { + if ( '\\Q' === substr( $token, 0, 2 ) ) { + // Quoting can't hold the delimiter or NUL bytes, so they are escaped between + // two quotes. Quoted text that runs to the end gets an "\E", so that a trailing + // backslash can't escape the delimiter. + $quoted = strtr( + $token, + array( + '/' => '\\E\\/\\Q', + "\0" => '\\E\\x00\\Q', + ) + ); + return '\\E' === substr( $token, -2 ) ? $quoted : $quoted . '\\E'; + } + $letters = $in_set ? self::REGEXP_LITERAL_SET_ESCAPES : self::REGEXP_LITERAL_ESCAPES; + if ( 2 === strlen( $token ) && '\\' === $token[0] && false !== strpos( $letters, $token[1] ) ) { + return $token[1]; + } + if ( preg_match( '/^\\\\[pP]\{/', $token ) ) { + return $this->regexp_set_fragment( $this->regexp_translate_property( $token, $tokens ) ); + } + if ( isset( $tokens[ $token ] ) ) { + return $tokens[ $token ]; + } + if ( ! preg_match( '/^(?:' . self::REGEXP_CODE_POINT_ESCAPE . ')$/', $token ) ) { + return $token; + } + if ( 'c' === $token[1] ) { + // ICU keeps the low 5 bits of X, and UTF-8 keeps the low 6 bits of a code point + // in its last byte. + $code = ord( substr( $token, -1 ) ) & 0x1F; + } elseif ( '0' === $token[1] ) { + $code = octdec( substr( $token, 2 ) ); + } elseif ( 12 === strlen( $token ) ) { + // A surrogate pair of "\u" escapes. + $code = 0x10000 + ( ( hexdec( substr( $token, 2, 4 ) ) - 0xD800 ) << 10 ) + hexdec( substr( $token, 8, 4 ) ) - 0xDC00; + } else { + $code = hexdec( substr( $token, 2 ) ); + } + return sprintf( '\\x{%X}', $code ); + } + + /** + * Translate a property, like "\p{Lowercase_Letter}" or "[:Lu:]", to PCRE. + * + * ICU takes the long names of general categories, a "gc=" prefix, and an "Is" + * prefix, like Java, and it ignores case, spaces, hyphens, and underscores in names. + * It reads both syntaxes the same way, so POSIX classes, like "alnum" or "word", + * work as "\p{...}" too, and general categories as "[:...:]". Other names, like + * scripts, go to PCRE. + * + * @param string $token The property, like "\p{...}", "\P{...}", or "[:...:]". + * @param string[] $tokens Translations of tokens. + * + * @return array The PCRE equivalent, as array( PCRE class body or fragment, whether it's a class body ). + */ + private function regexp_translate_property( $token, $tokens ) { + if ( ! preg_match( '/^(?:\\\\([pP])\{(.*)\}|\[:(\^?)(.*):\])$/s', $token, $parts ) ) { + return array( $token, true ); } - return $escaped; + $negated = 'P' === $parts[1] || '^' === ( $parts[3] ?? '' ); + $name = '' === $parts[1] ? $parts[4] : $parts[2]; + $loose = preg_replace( '/^(?:is|gc=|generalcategory=)(?=.)/', '', strtolower( str_replace( array( ' ', '-', '_' ), '', $name ) ) ); + + // In ICU, "\p{Uppercase}" and "\p{Lowercase}" are [:upper:] and [:lower:], so they + // ignore case the same way. + $loose = array( + 'uppercase' => 'upper', + 'lowercase' => 'lower', + )[ $loose ] ?? $loose; + + if ( in_array( $loose, self::REGEXP_POSIX_CLASSES, true ) ) { + $class = '[:' . ( $negated ? '^' : '' ) . $loose . ':]'; + } else { + if ( isset( self::REGEXP_GENERAL_CATEGORIES[ $loose ] ) ) { + $name = self::REGEXP_GENERAL_CATEGORIES[ $loose ]; + } elseif ( in_array( ucfirst( $loose ), self::REGEXP_GENERAL_CATEGORIES, true ) ) { + $name = ucfirst( $loose ); + } else { + $name = preg_replace( '/^is(?=.)/i', '', $name ); + } + $class = ( $negated ? '\\P{' : '\\p{' ) . $name . '}'; + } + + // The translations of [:upper:] and similar classes apply to their other names too. + // A negated translation, like the one of [:^word:], can't join a class. + $class = $tokens[ $class ] ?? $class; + return '[^' === substr( $class, 0, 2 ) ? array( $class, false ) : array( $class, true ); } /** @@ -1558,8 +2008,8 @@ private function regexp_matches( $pattern, $match_type, $byte_mode, $subject, $o /* * Only PCRE's "\K" can start a match before the search, and then the next - * search would find the same match forever. The escaper reads "\K" as "K", - * but not after a "\Q" in a comment, which it reads as quoted text. + * search would find the same match forever. The translation reads "\K" as + * "K", except after a "\Q" in an extended comment. */ if ( $match[0][1] < $offset ) { throw new Exception( 'Invalid regular expression: ' . $pattern . '.' ); diff --git a/packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php b/packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php index 615959486..be2b0111b 100644 --- a/packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php +++ b/packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php @@ -381,11 +381,15 @@ public function testRegexpLikeErrors( $sql, $message ) { public static function regexpLikeErrors() { return array( 'invalid pattern' => array( "REGEXP_LIKE('abc', '(abc')", 'Invalid regular expression: (abc.' ), - 'unknown escape' => array( "REGEXP_LIKE('y', '\\\\y')", 'Invalid regular expression: \\y.' ), - 'ICU escape' => array( "REGEXP_LIKE('A', '\\\\u0041')", 'Invalid regular expression: \\u0041.' ), + 'short escape' => array( "REGEXP_LIKE('u004', '\\\\u004')", 'Invalid regular expression: \\u004.' ), 'bad property' => array( "REGEXP_LIKE('a', '\\\\p{Foo}')", 'Invalid regular expression: \\p{Foo}.' ), - 'operator escape' => array( "'y' REGEXP '\\\\y'", 'Invalid regular expression: \\y.' ), - 'binary escape' => array( "X'FF' REGEXP '\\\\y'", 'Invalid regular expression: \\y.' ), + 'open comment' => array( "REGEXP_LIKE('a', 'a(?#')", 'Invalid regular expression: a(?#.' ), + 'comment quote' => array( "REGEXP_LIKE('a', '(?#\\\\Q)a')", 'Invalid regular expression: (?#\\Q)a.' ), + 'property with /' => array( "REGEXP_LIKE('a', '\\\\p{a/i}')", 'Invalid regular expression: \\p{a/i}.' ), + '"\\b+"' => array( "REGEXP_LIKE('b', '\\\\b+')", 'Invalid regular expression: \\b+.' ), + '"\\B*"' => array( "REGEXP_LIKE('b', '\\\\B*')", 'Invalid regular expression: \\B*.' ), + '"\\b{2}"' => array( "REGEXP_LIKE('b', '\\\\b{2}')", 'Invalid regular expression: \\b{2}.' ), + '"\\b{x}"' => array( "REGEXP_LIKE('b{x}', '\\\\b{x}')", 'Invalid regular expression: \\b{x}.' ), 'extra argument' => array( "REGEXP_LIKE('abc', 'abc', 'c', 'extra')", 'SQLSTATE[HY000]: General error: 1 wrong number of arguments to function REGEXP_LIKE()', @@ -393,6 +397,20 @@ public static function regexpLikeErrors() { ); } + public function testRegexpOperatorLiteralEscape() { + // The REGEXP operator reads "\y" literally too, also when it matches bytes. + $this->assertQuery( "SELECT 'y' REGEXP '\\\\y' AS text_result, X'FF79' REGEXP '\\\\y' AS binary_result" ); + $this->assertEquals( + array( + (object) array( + 'text_result' => '1', + 'binary_result' => '1', + ), + ), + $this->last_result + ); + } + /** * @dataProvider regexpMatchTypeFlagCases */ @@ -442,6 +460,8 @@ public static function regexpBinaryDataCases() { 'REGEXP_REPLACE, pos one past end' => array( "X'C485FF'", "REGEXP_REPLACE(b, '\$', 'x', 4)", "\xC4\x85\xFFx" ), 'REGEXP_REPLACE, occurrence' => array( "X'C485FF'", "REGEXP_REPLACE(b, '(.)', '[\$1]', 2, 1)", "\xC4[\x85]\xFF" ), 'REGEXP_REPLACE, empty matches' => array( "X'C485FF'", "REGEXP_REPLACE(b, 'x*', '-')", "-\xC4-\x85-\xFF-" ), + 'REGEXP_REPLACE, word characters' => array( "X'61812D62'", "REGEXP_REPLACE(b, '\\\\w', 'x')", "x\x81-x" ), + 'REGEXP_REPLACE, word boundaries' => array( "X'61812D62'", "REGEXP_REPLACE(b, '\\\\b', '|')", "|a|\x81-|b|" ), 'REGEXP_SUBSTR, any byte' => array( "X'61FF62'", "REGEXP_SUBSTR(b, 'a.b')", "a\xFFb" ), 'REGEXP_SUBSTR, other case' => array( "X'61FF41'", "REGEXP_SUBSTR(b, 'a.a')", null ), @@ -548,6 +568,26 @@ public function testRegexpLegacyOperatorRegression() { $this->assertSame( '0', $this->last_result[0]->r ); } + /** + * @dataProvider regexpLegacyWordBoundaryCases + */ + public function testRegexpLegacyWordBoundaries( $sql, $expected ) { + $this->assertQuery( "SELECT $sql AS r" ); + $this->assertSame( $expected, $this->last_result[0]->r ); + } + + public static function regexpLegacyWordBoundaryCases() { + // MySQL 8 rejects MySQL 5.7's word boundaries, but they keep working. + return array( + 'start and end of a word' => array( "'ab cd' REGEXP '[[:<:]]cd[[:>:]]'", '1' ), + 'inside of a word' => array( "'abcd' REGEXP '[[:<:]]cd'", '0' ), + 'before a word character' => array( "'cde' REGEXP 'cd[[:>:]]'", '0' ), + 'ignoring case' => array( "'AB CD' REGEXP '[[:<:]]cd[[:>:]]'", '1' ), + 'REGEXP BINARY' => array( "'ab cd' REGEXP BINARY '[[:<:]]cd'", '1' ), + 'REGEXP_LIKE' => array( "REGEXP_LIKE('ab cd', '[[:<:]]cd')", '1' ), + ); + } + public function testRegexpLegacyOperatorNullPropagation() { $this->assertQuery( "SELECT NULL REGEXP 'a' AS r" ); $this->assertNull( $this->last_result[0]->r ); @@ -589,7 +629,7 @@ public function testRegexpLegacyOperatorUtf8Handling() { public function testRegexpNulBytePattern() { // A pattern starting with a NUL byte is an ordinary case-insensitive pattern. - // NUL bytes also match in quoted text and after a backslash. + // NUL bytes also match in quoted text, after a backslash, and in sets. $this->assertQuery( 'CREATE TABLE nul_patterns (id INT PRIMARY KEY, s TEXT, p TEXT)' ); $this->assertQuery( "INSERT INTO nul_patterns VALUES @@ -597,7 +637,9 @@ public function testRegexpNulBytePattern() { (2, 'aBc', X'0062'), (3, 'abc', 'B'), (4, X'61002F62', CONCAT('\\\\Qa', X'00', '/b\\\\E')), - (5, X'610062', CONCAT('a\\\\', X'00', 'B'))" + (5, X'610062', CONCAT('a\\\\', X'00', 'B')), + (6, X'610062', CONCAT('[', X'00', ']')), + (7, X'610062', CONCAT('[\\\\Q', X'00', '\\\\E]'))" ); $this->assertQuery( 'SELECT @@ -645,6 +687,20 @@ public function testRegexpNulBytePattern() { 'like_matched' => '1', 'position' => '1', ), + (object) array( + 'matched' => '1', + 'not_matched' => '0', + 'binary_matched' => '1', + 'like_matched' => '1', + 'position' => '2', + ), + (object) array( + 'matched' => '1', + 'not_matched' => '0', + 'binary_matched' => '1', + 'like_matched' => '1', + 'position' => '2', + ), ), $this->last_result ); @@ -827,6 +883,30 @@ public static function regexpUnterminatedQuoteCases() { ); } + public function testRegexpQuotedTextInExtendedMode() { + // Quoted spaces, tabs, and "#" stay literal in extended mode. + $this->assertQuery( + "SELECT + REGEXP_LIKE('a b', '^(?x)\\\\Qa b\\\\E\$') AS space, + REGEXP_LIKE('ab', '^(?x)\\\\Qa b\\\\E\$') AS no_space, + REGEXP_LIKE('a\tb', '^(?x)\\\\Qa\tb\\\\E\$') AS tab, + REGEXP_LIKE('a#b', '^(?x)\\\\Qa#b\\\\E\$') AS hash, + REGEXP_LIKE('a', '^(?x)\\\\Qa#b\\\\E') AS comment" + ); + $this->assertEquals( + array( + (object) array( + 'space' => '1', + 'no_space' => '0', + 'tab' => '1', + 'hash' => '1', + 'comment' => '0', + ), + ), + $this->last_result + ); + } + public function testRegexpLikeNumericOperands() { $this->assertQuery( 'SELECT REGEXP_LIKE(123, 2) AS r' ); $this->assertSame( '1', $this->last_result[0]->r ); @@ -1144,6 +1224,7 @@ public static function regexpMatchEndAnchorCases() { 'REGEXP_REPLACE, second occurrence' => array( "REGEXP_REPLACE('aab', '\\\\Ga', '-', 1, 2)", 'a-b' ), 'REGEXP_REPLACE, in a comment' => array( "REGEXP_REPLACE('aa', '(?#\\\\G)a', 'x', 2)", 'ax' ), 'REGEXP_REPLACE, escaped backslash' => array( "REGEXP_REPLACE('a\\\\Gb', '\\\\\\\\G', '-', 2)", 'a-b' ), + 'REGEXP_REPLACE, letter in a set' => array( "REGEXP_REPLACE('aGb', '[\\\\G]', 'x', 2)", 'axb' ), 'REGEXP_SUBSTR, after empty match' => array( "REGEXP_SUBSTR('abc', '\\\\G', 1, 2)", null ), 'REGEXP_SUBSTR, pos' => array( "REGEXP_SUBSTR('abc', '\\\\G.', 2)", null ), @@ -1449,8 +1530,10 @@ public function testRegexpEscapedKInLookbehind() { * @dataProvider regexpQuoteInCommentCases */ public function testRegexpEscapedKAfterQuoteInComment( $sql, $pattern ) { - // The escaper reads a "\Q" in a comment as quoted text, so a later "\K" reaches - // PCRE. A match that starts before the search is then an error, not an endless loop. + // The translation reads a "\Q" in an extended comment as quoted text, so a later + // "\K" reaches PCRE. A match that starts before the search is then an error, not an + // endless loop. In a "(?#...)" comment, "\Q" quotes the ")", like in ICU, so the + // comment has no end, which is an error too. $this->assertQueryError( 'SELECT ' . sprintf( $sql, $this->engine->quote( $pattern ) ), "Invalid regular expression: $pattern." @@ -1541,6 +1624,396 @@ public function testRegexpBigIntegerColumn() { ); } + /** + * @dataProvider regexpSetCases + * @dataProvider regexpCodePointEscapeCases + * @dataProvider regexpLiteralEscapeCases + * @dataProvider regexpWordCases + * @dataProvider regexpPropertyCases + * @dataProvider regexpCommentCases + */ + public function testRegexpIcuSyntax( $pattern, $subject, $expected ) { + $this->assertQuery( + sprintf( + "SELECT REGEXP_REPLACE(%s, %s, '<\$0>', 1, 0, 'c') AS r", + $this->engine->quote( $subject ), + $this->engine->quote( $pattern ) + ) + ); + $this->assertSame( $expected, $this->last_result[0]->r ); + } + + public static function regexpSetCases() { + return array( + // Nested sets are unions. + 'nested set' => array( '[a[b]]', 'abc', 'c' ), + 'nested range' => array( '[a-c[b]]', 'abcd', 'd' ), + 'nested negated set' => array( '[a[^b]]', 'abc', 'b' ), + 'negated union' => array( '[^a[^b]]', 'abc', 'ac' ), + '"]" first' => array( '[]a]', ']ab', '<]>b' ), + '"]" first, negated' => array( '[^]a]', ']ab', ']a' ), + '":" first' => array( '[:\w]+', 'a:b c', ' ' ), + '":" first, then a POSIX class' => array( '[:[:alpha:]]', 'a:1', '<:>1' ), + '"[:" without ":]"' => array( '[:a:b]', 'xab:', 'x<:>' ), + + // "--" and "&&" apply to the items up to the next of them, from left to right. + 'difference' => array( '[a-z--[b]--[c]]', 'abcd-', 'bc-' ), + 'difference of characters' => array( '[a-z--b--c]', 'abcd-', 'bc-' ), + 'difference of all items' => array( '[[a-c]--[b]x]', 'abcx', 'bx' ), + 'intersection' => array( '[\w&&[a-c]]', 'abd-', 'd-' ), + 'intersection of all items' => array( '[[a-c]&&[b]x]', 'abcx', 'acx' ), + 'intersection, then difference' => array( '[a-z&&[a-m]--c]', 'abcdn-', 'cn-' ), + 'difference, then intersection' => array( '[[a-z]--[b]&&[a-c]]', 'abcd-', 'bd-' ), + 'negated intersection' => array( '[^[a-c]&&[b-d]]', 'abcd', 'bc' ), + 'empty intersection' => array( '[a&&b]', 'ab', 'ab' ), + 'class escapes' => array( '[\w--\d]', 'a1_', '1<_>' ), + 'POSIX classes' => array( '[[:alpha:]&&[:upper:]]', 'aBc', 'ac' ), + 'literal "&" after "&&"' => array( '[&abcd&&&ac]', 'bac&&cad', 'b<&><&>d' ), + 'literal "-" after "--"' => array( '[-abcd---]', 'abc--', '--' ), + + // A single "-" or "&" between two sets applies to all the items before it. Class + // escapes and properties right after the second set join that set. + 'single "-" between sets' => array( '[[a-m]-[f-w]p]', 'depfgwxyz', '

fgwxyz' ), + 'single "-", chained' => array( '[[a-z]-[aeiou]-[xyz]]', 'abex-', 'aex-' ), + 'single "-" in an operand' => array( '[a-z--[b]-[c]]', 'abcd-', 'b-' ), + 'single "-" after a property' => array( '[\p{L}-[:digit:]]', 'a-5', '-5' ), + 'single "-" after a POSIX class' => array( '[[:digit:]-[:alpha:]]', '0-z', '<0>-z' ), + 'single "&" between sets' => array( '[[a-m]&[e-s]w]', 'efmwadnst', 'adnst' ), + 'single "&" after a property' => array( '[\p{L}&[a]]', 'ab&', 'b&' ), + 'single "-" after a union' => array( '[a[b]-[a]]', 'ab', 'a' ), + 'single "-" after a union of sets' => array( '[[a][b]-[a][c]]', 'abc', 'a' ), + 'single "&" after a union' => array( '[x[a-m]&[e-s]]', 'xaf', 'xa' ), + 'class escape after a single "-"' => array( '[[a-z]-[aeiou]\d]', 'ba1', 'a1' ), + 'class escape after a single "&"' => array( '[[a-z]&[a-m]\d]', 'bn1', 'n1' ), + 'property after a single "-"' => array( '[[a-z]-[aeiou]\p{Nd}]', 'ba1', 'a1' ), + '"-" after a joined property' => array( '[[a-z]-[aeiou]\p{Nd}-[b]]', 'bc1', 'b1' ), + 'letter after a joined escape' => array( '[[a-z]-[aeiou]\d1]', '12b', '<1>2' ), + 'POSIX class after a single "-"' => array( '[[a-z]-[aeiou][:digit:]]', 'a1b', 'a<1>' ), + + // Elsewhere, "-" and "&" are literal, unless "-" makes a range. + '"-" after a class escape' => array( '[\w-[0-9]]', 'a-5_', '<-><5><_>' ), + '"-" before a property' => array( '[\p{L}-\p{N}]', 'a-5', '<-><5>' ), + '"-" after a set, before a letter' => array( '[[a]-b]', 'ab-', '<->' ), + '"-" after a letter, before a set' => array( '[ab-[c]]', 'abc-', '<->' ), + '"-" after a letter, after a set' => array( '[[a]b-[b]]', 'ab-', '<->' ), + '"-" after a letter, before POSIX' => array( '[a-[:digit:]]', 'za-9', 'z<-><9>' ), + '"-" after a POSIX class' => array( '[[:digit:]-z]', '0-z=', '<0><->=' ), + '"-" after a range' => array( '[a-c-e]', 'abcde-', 'd<->' ), + '"-" first and last' => array( '[-a]', 'a-b', '<->b' ), + '"-" after "^"' => array( '[^-a]', '-ab', '-a' ), + '"&" between a set and a letter' => array( '[[a]&b]', 'ab&', '<&>' ), + '"&" between a letter and a set' => array( '[abcd&[ac]]', 'bd&x', '<&>x' ), + '"&" before a class escape' => array( '[[a-c]&\w]', 'abd-&', '-<&>' ), + '"&" last' => array( '[a-z&]', 'a&', '<&>' ), + 'escaped bracket' => array( '[\[a]', '[a', '<[>' ), + 'escaped hyphen' => array( '[a\-z]', 'a-zb', '<->b' ), + 'hex range' => array( '[\x{41}-\x{43}]', 'ABCD', 'D' ), + 'quoted bracket' => array( '[\Qa]\E]', ']a', '<]>' ), + 'empty quotes' => array( '[\W\Q\E]', 'a:', 'a<:>' ), + 'empty quotes outside of a set' => array( '(a)\1\Q\E0', 'aa0', '' ), + 'empty quotes before "-"' => array( '[\Q\E-\w]', 'a-', '<->' ), + 'empty quotes after a set' => array( '[[a]\Q\E-z]', 'am-z', 'm<->' ), + 'empty quotes before a set' => array( '[[a]-\Q\E[b]]', 'ab-', 'b-' ), + 'quotes that end a range' => array( '[a-\Qbc\E-z]', 'cm-', '-' ), + 'slash' => array( '[/a]', '/ab', 'b' ), + 'quoted slash' => array( '[\Q/\E]', 'a/', 'a' ), + 'slash in a difference' => array( '[[/a]--[a]]', '/a', 'a' ), + 'long set' => array( '[' . str_repeat( 'ab', 10000 ) . ']+', 'xab', 'x' ), + '"[]" in an extended comment' => array( "(?x)a # []\nb", 'ab', '' ), + '"[^]" in an extended comment' => array( "(?x)a # [^]\nb", 'ab', '' ), + '"\\c[" in a set' => array( '[\c[]', "a\e", "a<\e>" ), + '"\\c]" in a set' => array( '[\c]]', "a\x1D", "a<\x1D>" ), + + // A POSIX class outside of a set is a set. + 'POSIX class outside of a set' => array( '[:alpha:]+', 'ab1', '1' ), + 'negated POSIX class' => array( '[:^alpha:]', 'a1', 'a<1>' ), + 'POSIX class after a letter' => array( 'x[:alpha:]', 'xa', '' ), + + // Sets in lookbehinds. + 'negated union in a lookbehind' => array( '(?a<>b<>c<>' ), + 'empty set in a lookbehind' => array( '(?a<>b<>c<>' ), + ); + } + + public static function regexpCodePointEscapeCases() { + return array( + '"\\u"' => array( '\\u0041', 'ABA', 'B' ), + '"\\u" in a set' => array( '[\\u0041c]+', 'AcAcdef', 'def' ), + '"\\u" range' => array( '[\\u0041-\\u0043]', 'ABCD', 'D' ), + '"\\u", 2 bytes' => array( 'caf\\u00e9', 'café', '' ), + '"\\U"' => array( '\\U00010400', '𐐀', '<𐐀>' ), + '"\\U" range' => array( '[\\u0000-\\U0010ffff]+', 'a😀', '' ), + 'negated "\\U" range' => array( '[^\\u0000-\\U0010ffff]', 'a😀', 'a😀' ), + 'surrogate pair' => array( '\\ud800\\udc00', 'a𐀀', 'a<𐀀>' ), + 'surrogate pair, uppercase' => array( '\\uD800\\uDC00', 'a𐀀', 'a<𐀀>' ), + 'escaped backslash' => array( '\\\\\\u0041', 'A', 'A' ), + 'quoted' => array( '\\Q\\u0041\\E', 'u0041', 'u0041' ), + 'octal' => array( '\\0101', 'ABA', 'B' ), + 'octal, 1 and 2 digits' => array( '\\0154\\01442', 'ld2', '' ), + 'octal up to 0377' => array( '\\0376', 'þ', '<þ>' ), + 'octal past 0377' => array( '\\0400', ' 0', '< 0>' ), + 'octal NUL' => array( '\\00', 'a', 'a' ), + 'octal range' => array( '[\\0101-\\0103]', 'ABCD', 'D' ), + '"\\x4" in a nested set' => array( '[\\x4[5]]', "\x045E", "<\x04><5>E" ), + '"\\x4" before quotes' => array( '\\x4\\Q\\E5', "\x045E", "<\x045>E" ), + '"\\x4", quotes in a set' => array( '[\\x4\\Q\\E5]', "\x045E", "<\x04><5>E" ), + '"\\c" and a digit' => array( '\\c1', "q\x11", "q<\x11>" ), + '"\\c?"' => array( '\\c?', "\x7F\x1F", "\x7F<\x1F>" ), + '"\\c/"' => array( '\\c/', "/\x0F", "/<\x0F>" ), + '"\\c\\" at the end' => array( 'a\\c\\', "a\x1C", "" ), + '"\\c" and 2 bytes' => array( "\\c\u{E9}", "\x03\x09", "\x03<\x09>" ), + '"\\c" in a set' => array( '[\\c1]', "q\x11", "q<\x11>" ), + ); + } + + public static function regexpLiteralEscapeCases() { + return array( + '"\\y"' => array( '\\y', 'xy', 'x' ), + '"\\j" in a set' => array( '[\\j]+', 'jjx', 'x' ), + '"\\K"' => array( 'a\\Kb', 'abaKb', 'ab' ), + '"\\K" in a lookbehind' => array( '(?<=\\Ka)', 'Kaa', 'Ka<>a' ), + '"\\C"' => array( '\\C', 'aC', 'a' ), + '"\\E" outside of quotes' => array( 'a\\Eb', 'abaEb', 'ab' ), + '"\\b" in a set' => array( '[\\b]', 'ab', 'a' ), + '"\\z" in a set' => array( '[\\z]+', 'azz', 'a' ), + '"\\X" in a set' => array( '[\\X]', 'aX', 'a' ), + '"\\b" outside of a set' => array( '\\bb', 'ab b', 'ab ' ), + '"\\z" outside of a set' => array( 'a\\z', 'aa', 'a' ), + '"\\x4\\E"' => array( '\\x4\\E', "\x04E", "<\x04E>" ), + '"\\x4\\b" in a set' => array( '[\\x4\\b]', "\x04bK", "<\x04>K" ), + ); + } + + public static function regexpWordCases() { + return array( + '"\\w" and marks' => array( '\\w+', 'नमस्ते สวัสดี தமிழ்', '<नमस्ते> <สวัสดี> <தமிழ்>' ), + '"\\b" and marks' => array( '\\bहिन्दी\\b', 'हिन्दी है', '<हिन्दी> है' ), + '"\\b" and a combining accent' => array( "\\bcafe\u{301}\\b", "a cafe\u{301} b", "a b" ), + '"\\w" and other numbers' => array( '\\w', 'x²Ⅻ', '²<Ⅻ>' ), + '"\\w" and letter symbols' => array( '\\w', 'Ⓐ🄰', '<Ⓐ><🄰>' ), + '"\\w" and joiners' => array( '\\w+', "ab\u{200C}cd\u{200D}ef", "" ), + '"\\w" and connectors' => array( '\\w', '_‿', '<_><‿>' ), + '"\\W"' => array( '\\W+', "ab\u{200C}cd ²", "ab\u{200C}cd< ²>" ), + '"\\b"' => array( '\\b', 'ab cd', '<>ab<> <>cd<>' ), + '"\\B"' => array( '\\B', 'ab cd', 'a<>b c<>d' ), + '"\\w" in a set' => array( '[\\w]+', 'ab²', '²' ), + '"\\W" in a set' => array( '[\\W]+', 'ab²', 'ab<²>' ), + '"\\W" in a negated set' => array( '[^\\W]+', 'ab² c', '² ' ), + '"[:word:]"' => array( '[[:word:]]+', 'नमस्ते ²', '<नमस्ते> ²' ), + '"[:^word:]"' => array( '[[:^word:]]+', "ab\u{200C}cd ²", "ab\u{200C}cd< ²>" ), + '"[:word:]" outside of a set' => array( '[:word:]+', 'a²', '²' ), + '"\\p{word}"' => array( '\\p{word}+', 'a² b', '² ' ), + '"\\P{Word}"' => array( '\\P{Word}+', 'a² b', 'a<² >b' ), + '"\\w" in an intersection' => array( '[\\w&&[^a]]+', 'ab²c', 'a²' ), + '"\\d"' => array( '\\d+', '١٢٣ ²', '<١٢٣> ²' ), + ); + } + + public static function regexpPropertyCases() { + return array( + 'long name' => array( '\\p{Lowercase_Letter}+', 'aBc', 'B' ), + 'long name with spaces' => array( '\\p{lowercase letter}+', 'aBc', 'B' ), + 'long name in capitals' => array( '\\p{LOWERCASELETTER}+', 'aBc', 'B' ), + 'long name with hyphens' => array( '\\p{lowercase-letter}+', 'aBc', 'B' ), + 'negated long name' => array( '\\P{Uppercase_Letter}+', 'aBc', 'B' ), + 'short name in lowercase' => array( '\\p{lu}+', 'aBc', 'ac' ), + '"Is" prefix' => array( '\\p{IsLetter}+', 'a1b', '1' ), + '"Is" and a short name' => array( '\\p{IsLu}+', 'aBc', 'ac' ), + '"gc=" prefix' => array( '\\p{gc=Lu}+', 'aBc', 'ac' ), + '"General_Category="' => array( '\\p{General_Category=Lu}+', 'aBc', 'ac' ), + 'alias "punct"' => array( '\\p{punct}+', 'a.,b+', 'a<.,>b+' ), + 'alias "digit"' => array( '\\p{IsDigit}+', 'a12²', 'a<12>²' ), + 'cased letters' => array( '\\p{Cased_Letter}+', 'aB1', '1' ), + 'short name "LC"' => array( '\\p{LC}+', 'aB1', '1' ), + '"gc=" and "LC"' => array( '\\p{gc=LC}+', 'aB1', '1' ), + '"LC" in POSIX syntax' => array( '[:LC:]+', 'aB1', '1' ), + 'property in POSIX syntax' => array( '[:Lu:]+', 'aBc', 'ac' ), + 'long name in POSIX' => array( '[:Punctuation:]+', 'a.b', 'a<.>b' ), + 'negated POSIX property' => array( '[:^Lu:]+', 'aBc', 'B' ), + 'POSIX class as "\\p"' => array( '\\p{alnum}+', 'a1-', '-' ), + 'POSIX "xdigit" as "\\p"' => array( '\\p{xdigit}+', 'fg', 'g' ), + 'POSIX class as "\\P"' => array( '\\P{alpha}+', 'a1b', 'a<1>b' ), + '"Is" and "Uppercase"' => array( '\\p{IsUppercase}+', 'aBc', 'ac' ), + 'POSIX property in a set' => array( '[[:Lu:]x]+', 'aBxc', 'ac' ), + 'POSIX class in capitals' => array( '[:Alpha:]+', 'a1b', '1' ), + 'POSIX syntax with spaces' => array( '[:Uppercase Letter:]+', 'aBc', 'ac' ), + 'POSIX syntax with "gc="' => array( '[[:gc=Lu:]]+', 'aBc', 'ac' ), + 'negated POSIX with "gc="' => array( '[[:^gc=Lu:]]+', 'aBc', 'B' ), + 'script' => array( '\\p{Greek}+', 'aαβ', 'a<αβ>' ), + '"Is" and a script' => array( '\\p{IsGreek}+', 'aαβ', 'a<αβ>' ), + ); + } + + public static function regexpCommentCases() { + return array( + 'escape in a comment' => array( 'a(?#\b)b', 'ab', '' ), + 'set in a comment' => array( '(?#[a--])a', 'a', '' ), + 'quoted ")" in a comment' => array( '(?#\Q)a\E)b', 'ab', 'a' ), + 'slash in a comment' => array( '(?#/)a', 'a', '' ), + 'comment before a digit' => array( '(a)\1(?#)0', 'aa0', '' ), + 'comment in a set' => array( '[(?#)]+', '#)a', '<#)>a' ), + '"\\\\Q" in a comment' => array( '(?#\\\\Q)a', 'a', '' ), + ); + } + + /** + * @dataProvider regexpInvalidSetCases + */ + public function testRegexpInvalidSets( $pattern ) { + $this->assertQueryError( + sprintf( "SELECT REGEXP_LIKE('a', %s)", $this->engine->quote( $pattern ) ), + "Invalid regular expression: $pattern." + ); + } + + public static function regexpInvalidSetCases() { + return array( + 'empty set' => array( '[]' ), + 'empty negated set' => array( '[^]' ), + '"--" first' => array( '[--]' ), + '"&&" first' => array( '[&&a]' ), + '"--" last' => array( '[a--]' ), + '"&&" last' => array( '[a-z&&]' ), + '"--" first in a nested set' => array( '[abc[--def]]' ), + 'range to a class escape' => array( '[a-\w]' ), + 'POSIX class with a comma' => array( '[[:,:]]' ), + 'POSIX class with an escape' => array( '[:\w:]' ), + 'only empty quotes' => array( '[\Q\E]' ), + ); + } + + /** + * @dataProvider regexpSetIgnoreCaseCases + */ + public function testRegexpSetsIgnoreCase( $sql, $expected ) { + $this->assertQuery( "SELECT $sql AS r" ); + $this->assertSame( $expected, $this->last_result[0]->r ); + } + + public static function regexpSetIgnoreCaseCases() { + // Without the "c" flag, set operations ignore case, also in their operands. + return array( + 'difference' => array( "REGEXP_LIKE('B', '^[a-z--[aeiou]]\$')", '1' ), + 'difference, removed' => array( "REGEXP_LIKE('A', '^[a-z--[aeiou]]\$')", '0' ), + 'intersection' => array( "REGEXP_LIKE('b', '^[a-z&&[A-C]]\$')", '1' ), + 'intersection, removed' => array( "REGEXP_LIKE('D', '^[a-z&&[A-C]]\$')", '0' ), + 'single "-"' => array( "REGEXP_LIKE('b', '^[[a-z]-[B]]\$')", '0' ), + 'negated difference' => array( "REGEXP_LIKE('E', '^[^a-z--[aeiou]]\$')", '1' ), + ); + } + + /** + * @dataProvider regexpPosixCaseClassCases + */ + public function testRegexpPosixCaseClasses( $sql, $expected ) { + $this->assertQuery( "SELECT $sql AS r" ); + $this->assertSame( $expected, $this->last_result[0]->r ); + } + + public static function regexpPosixCaseClassCases() { + return array( + // Without the "c" flag, the classes ignore case, like in MySQL. + 'upper, lowercase' => array( "REGEXP_LIKE('a', '[[:upper:]]')", '1' ), + 'lower, uppercase' => array( "REGEXP_LIKE('A', '[[:lower:]]')", '1' ), + 'upper, non-ASCII' => array( "REGEXP_LIKE('é', '[[:upper:]]')", '1' ), + 'lower, non-ASCII' => array( "REGEXP_LIKE('É', '[[:lower:]]')", '1' ), + 'upper, digit' => array( "REGEXP_LIKE('1', '[[:upper:]]')", '0' ), + 'negated class' => array( "REGEXP_LIKE('a', '[[:^upper:]]')", '0' ), + 'negated class, digit' => array( "REGEXP_LIKE('1', '[[:^upper:]]')", '1' ), + 'negated set' => array( "REGEXP_LIKE('a', '[^[:upper:]]')", '0' ), + 'with other set members' => array( "REGEXP_LIKE('a', '^[[:upper:]0-9]\$')", '1' ), + 'outside of a set' => array( "REGEXP_LIKE('a', '[:upper:]')", '1' ), + 'set difference' => array( "REGEXP_LIKE('a', '^[[:upper:]--[b]]\$')", '1' ), + 'set difference, removed' => array( "REGEXP_LIKE('b', '^[[:upper:]--[b]]\$')", '0' ), + 'REGEXP_REPLACE' => array( "REGEXP_REPLACE('abC', '[[:lower:]]', 'x')", 'xxx' ), + 'REGEXP_SUBSTR' => array( "REGEXP_SUBSTR('abc1', '[[:upper:]]+')", 'abc' ), + 'REGEXP_INSTR' => array( "REGEXP_INSTR('1a', '[[:upper:]]')", '2' ), + 'operator' => array( "'a' REGEXP '[[:upper:]]'", '1' ), + 'negated operator' => array( "'a' NOT REGEXP '[[:upper:]]'", '0' ), + + // So do the matching Unicode properties. + '\\p{Lu}, lowercase' => array( "REGEXP_LIKE('a', '\\\\p{Lu}')", '1' ), + '\\p{Ll}, uppercase' => array( "REGEXP_LIKE('A', '\\\\p{Ll}')", '1' ), + '\\p{Lu}, non-ASCII' => array( "REGEXP_LIKE('é', '\\\\p{Lu}')", '1' ), + '\\p{Lu}, digit' => array( "REGEXP_LIKE('1', '\\\\p{Lu}')", '0' ), + '\\P{Lu}, lowercase' => array( "REGEXP_LIKE('a', '\\\\P{Lu}')", '0' ), + '\\P{Lu}, digit' => array( "REGEXP_LIKE('1', '\\\\P{Lu}')", '1' ), + '\\p{Lu} in a set' => array( "REGEXP_LIKE('a', '[\\\\p{Lu}]')", '1' ), + '\\p{Lu} in a negated set' => array( "REGEXP_LIKE('a', '[^\\\\p{Lu}]')", '0' ), + '\\p{Lu}, intersection' => array( "REGEXP_LIKE('a', '^[\\\\p{Lu}&&[a-c]]\$')", '1' ), + 'long name, lowercase' => array( "REGEXP_LIKE('a', '\\\\p{Uppercase_Letter}')", '1' ), + 'capitals, lowercase' => array( "REGEXP_LIKE('a', '[[:Upper:]]')", '1' ), + '\\p{Upper}, lowercase' => array( "REGEXP_LIKE('a', '\\\\p{Upper}')", '1' ), + '\\p{Lower}, uppercase' => array( "REGEXP_LIKE('A', '\\\\p{Lower}')", '1' ), + '\\p{Uppercase}' => array( "REGEXP_LIKE('a', '\\\\p{Uppercase}')", '1' ), + '[:Uppercase:]' => array( "REGEXP_LIKE('a', '[[:Uppercase:]]')", '1' ), + '\\p{Upper}, c flag' => array( "REGEXP_LIKE('a', '\\\\p{Upper}', 'c')", '0' ), + '\\p{Lu}, REGEXP_REPLACE' => array( "REGEXP_REPLACE('aB1', '\\\\p{Lu}', 'x')", 'xx1' ), + '\\p{Ll}, operator' => array( "'A' REGEXP '\\\\p{Ll}'", '1' ), + '\\p{Lu}, c flag' => array( "REGEXP_LIKE('a', '\\\\p{Lu}', 'c')", '0' ), + '\\p{Lu}, inline flag' => array( "REGEXP_LIKE('a', '(?-i)\\\\p{Lu}')", '0' ), + 'quoted \\p{Lu}' => array( "REGEXP_LIKE('a', '\\\\Q\\\\p{Lu}\\\\E')", '0' ), + 'escaped backslash' => array( "REGEXP_LIKE('\\\\p{Lu}', '^\\\\\\\\p\\\\{Lu\\\\}\$')", '1' ), + + // With the "c" flag, the classes keep their case. + 'c flag, upper' => array( "REGEXP_LIKE('A', '[[:upper:]]', 'c')", '1' ), + 'c flag, other case' => array( "REGEXP_LIKE('a', '[[:upper:]]', 'c')", '0' ), + 'c flag, lower other case' => array( "REGEXP_LIKE('A', '[[:lower:]]', 'c')", '0' ), + + // So they do with "(?-i)", which is how the REGEXP operator matches case. + 'inline flag, upper' => array( "REGEXP_LIKE('A', '(?-i)[[:upper:]]')", '1' ), + 'inline flag, other case' => array( "REGEXP_LIKE('a', '(?-i)[[:upper:]]')", '0' ), + 'inline flag in a group' => array( "REGEXP_LIKE('a', '(?-i:[[:upper:]])')", '0' ), + 'inline flag among others' => array( "REGEXP_LIKE('a', '(?s-i)[[:upper:]]')", '0' ), + 'inline flag, operator' => array( "'a' REGEXP '(?-i)[[:upper:]]'", '0' ), + + // Escaped and quoted text is not a class. + 'escaped bracket' => array( "REGEXP_LIKE('[:upper:]', '^\\\\[:upper:]\$')", '1' ), + 'escaped bracket, letter' => array( "REGEXP_LIKE('a', '^\\\\[:upper:]\$')", '0' ), + 'quoted class' => array( "REGEXP_LIKE('[:upper:]', '^\\\\Q[:upper:]\\\\E\$')", '1' ), + 'quoted class, letter' => array( "REGEXP_LIKE('a', '\\\\Q[:upper:]\\\\E')", '0' ), + ); + } + + /** + * @dataProvider regexpPosixPunctCases + */ + public function testRegexpPosixPunct( $sql, $expected ) { + $this->assertQuery( "SELECT $sql AS r" ); + $this->assertSame( $expected, $this->last_result[0]->r ); + } + + public static function regexpPosixPunctCases() { + return array( + // ICU's class holds Unicode punctuation only, without ASCII symbols. + 'ASCII punctuation' => array( "REGEXP_LIKE('.', '[[:punct:]]')", '1' ), + 'plus' => array( "REGEXP_LIKE('+', '[[:punct:]]')", '0' ), + 'dollar' => array( "REGEXP_LIKE('\$', '[[:punct:]]')", '0' ), + 'equals' => array( "REGEXP_LIKE('=', '[[:punct:]]')", '0' ), + 'tilde' => array( "REGEXP_LIKE('~', '[[:punct:]]')", '0' ), + 'non-ASCII punctuation' => array( "REGEXP_LIKE('«', '[[:punct:]]')", '1' ), + 'non-ASCII symbol' => array( "REGEXP_LIKE('€', '[[:punct:]]')", '0' ), + 'c flag' => array( "REGEXP_LIKE('+', '[[:punct:]]', 'c')", '0' ), + 'negated class' => array( "REGEXP_LIKE('.', '[[:^punct:]]')", '0' ), + 'negated class, symbol' => array( "REGEXP_LIKE('+', '[[:^punct:]]')", '1' ), + 'with other set members' => array( "REGEXP_LIKE('+', '^[[:punct:]+]\$')", '1' ), + 'outside of a set' => array( "REGEXP_LIKE('.', '[:punct:]')", '1' ), + 'capitals, symbol' => array( "REGEXP_LIKE('+', '[[:PUNCT:]]')", '0' ), + 'REGEXP_REPLACE' => array( "REGEXP_REPLACE('a+b.c\$d,e=f!g', '[[:punct:]]', '')", 'a+bc$de=fg' ), + 'operator, punctuation' => array( "'.' REGEXP '[[:punct:]]'", '1' ), + 'operator, symbol' => array( "'+' REGEXP '[[:punct:]]'", '0' ), + 'quoted class' => array( "REGEXP_LIKE('.', '\\\\Q[:punct:]\\\\E')", '0' ), + ); + } + + public function testRegexpPosixPunctOnBinaryData() { + // Bytes that are not valid UTF-8 are read as Latin-1, where 0xAB is "«". + $this->assertQuery( 'CREATE TABLE blobs (id INT PRIMARY KEY, b BLOB)' ); + $this->assertQuery( "INSERT INTO blobs VALUES (1, X'2BFF'), (2, X'2EFF'), (3, X'AB')" ); + $this->assertQuery( "SELECT b REGEXP '[[:punct:]]' AS r FROM blobs ORDER BY id" ); + $this->assertSame( array( '0', '1', '1' ), array_column( $this->last_result, 'r' ) ); + } + public function testInsertDateNow() { $this->assertQuery( "INSERT INTO _dates (option_name, option_value) VALUES ('first', now());" diff --git a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Instr_Tests.php b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Instr_Tests.php index 64f1c94c6..eb3f9ae4d 100644 --- a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Instr_Tests.php +++ b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Instr_Tests.php @@ -14,56 +14,6 @@ protected function get_known_failures(): array { // Cases that fail in every environment. $failures = array( - 'mysql-server-suite:7923', - 'mysql-server-suite:7924', - 'mysql-server-suite:9591', - 'mysql-server-suite:9592', - 'mysql-server-suite:9593', - 'mysql-server-suite:9594', - 'mysql-server-suite:9595', - 'mysql-server-suite:9596', - 'mysql-server-suite:9597', - 'mysql-server-suite:9598', - 'mysql-server-suite:9599', - 'mysql-server-suite:9600', - 'mysql-server-suite:9601', - 'mysql-server-suite:9602', - 'mysql-server-suite:9603', - 'mysql-server-suite:9604', - 'mysql-server-suite:9605', - 'mysql-server-suite:9606', - 'mysql-server-suite:9607', - 'mysql-server-suite:9608', - 'mysql-server-suite:9609', - 'mysql-server-suite:9610', - 'mysql-server-suite:9611', - 'mysql-server-suite:9612', - 'mysql-server-suite:9613', - 'mysql-server-suite:9614', - 'mysql-server-suite:9615', - 'mysql-server-suite:9616', - 'mysql-server-suite:9643', - 'mysql-server-suite:9644', - 'mysql-server-suite:9647', - 'mysql-server-suite:9648', - 'mysql-server-suite:9649', - 'mysql-server-suite:9650', - 'mysql-server-suite:9651', - 'mysql-server-suite:9652', - 'mysql-server-suite:9653', - 'mysql-server-suite:9654', - 'mysql-server-suite:9655', - 'mysql-server-suite:9656', - 'mysql-server-suite:9657', - 'mysql-server-suite:9658', - 'mysql-server-suite:9659', - 'mysql-server-suite:9660', - 'mysql-server-suite:9661', - 'mysql-server-suite:9662', - 'mysql-server-suite:9665', - 'mysql-server-suite:9666', - 'mysql-server-suite:9667', - 'mysql-server-suite:9668', 'mysql-server-suite:12325', 'mysql-server-suite:12326', 'mysql-server-suite:12327', @@ -116,62 +66,7 @@ protected function get_known_failures(): array { 'mysql-server-suite:12374', 'mysql-server-suite:12375', 'mysql-server-suite:12376', - 'mysql-server-suite:12455', - 'mysql-server-suite:12456', - 'mysql-server-suite:12457', - 'mysql-server-suite:12458', - 'mysql-server-suite:12459', - 'mysql-server-suite:12460', - 'mysql-server-suite:12461', - 'mysql-server-suite:12462', - 'mysql-server-suite:12463', - 'mysql-server-suite:12464', - 'mysql-server-suite:12465', - 'mysql-server-suite:12466', - 'mysql-server-suite:12467', - 'mysql-server-suite:12468', - 'mysql-server-suite:12469', - 'mysql-server-suite:12470', - 'mysql-server-suite:12471', - 'mysql-server-suite:12472', - 'mysql-server-suite:12473', - 'mysql-server-suite:12474', - 'mysql-server-suite:12475', - 'mysql-server-suite:12476', - 'mysql-server-suite:12477', - 'mysql-server-suite:12478', 'mysql-server-suite:12479', - 'mysql-server-suite:12480', - 'mysql-server-suite:12481', - 'mysql-server-suite:12482', - 'mysql-server-suite:12483', - 'mysql-server-suite:12484', - 'mysql-server-suite:12485', - 'mysql-server-suite:12486', - 'mysql-server-suite:12487', - 'mysql-server-suite:12488', - 'mysql-server-suite:12489', - 'mysql-server-suite:12490', - 'mysql-server-suite:12491', - 'mysql-server-suite:12492', - 'mysql-server-suite:12493', - 'mysql-server-suite:12494', - 'mysql-server-suite:12495', - 'mysql-server-suite:12496', - 'mysql-server-suite:12497', - 'mysql-server-suite:12498', - 'mysql-server-suite:12499', - 'mysql-server-suite:12500', - 'mysql-server-suite:12501', - 'mysql-server-suite:12502', - 'mysql-server-suite:12503', - 'mysql-server-suite:12504', - 'mysql-server-suite:12505', - 'mysql-server-suite:12506', - 'mysql-server-suite:12507', - 'mysql-server-suite:12508', - 'mysql-server-suite:12509', - 'mysql-server-suite:12510', 'mysql-server-suite:12589', 'mysql-server-suite:12590', 'mysql-server-suite:12591', @@ -204,10 +99,6 @@ protected function get_known_failures(): array { 'icu-regextst:147', 'icu-regextst:148', 'icu-regextst:149', - 'icu-regextst:165', - 'icu-regextst:166', - 'icu-regextst:209', - 'icu-regextst:210', 'icu-regextst:219', 'icu-regextst:220', 'icu-regextst:221', @@ -222,36 +113,10 @@ protected function get_known_failures(): array { 'icu-regextst:232', 'icu-regextst:233', 'icu-regextst:234', - 'icu-regextst:329', - 'icu-regextst:330', - 'icu-regextst:365', - 'icu-regextst:366', - 'icu-regextst:367', - 'icu-regextst:368', - 'icu-regextst:373', - 'icu-regextst:374', - 'icu-regextst:375', - 'icu-regextst:376', - 'icu-regextst:377', - 'icu-regextst:378', 'icu-regextst:383', 'icu-regextst:384', 'icu-regextst:385', 'icu-regextst:386', - 'icu-regextst:387', - 'icu-regextst:388', - 'icu-regextst:389', - 'icu-regextst:390', - 'icu-regextst:391', - 'icu-regextst:392', - 'icu-regextst:393', - 'icu-regextst:394', - 'icu-regextst:395', - 'icu-regextst:396', - 'icu-regextst:397', - 'icu-regextst:398', - 'icu-regextst:399', - 'icu-regextst:400', 'icu-regextst:520', 'icu-regextst:521', 'icu-regextst:522', @@ -272,12 +137,6 @@ protected function get_known_failures(): array { 'icu-regextst:565', 'icu-regextst:566', 'icu-regextst:567', - 'icu-regextst:580', - 'icu-regextst:581', - 'icu-regextst:582', - 'icu-regextst:583', - 'icu-regextst:584', - 'icu-regextst:585', 'icu-regextst:590', 'icu-regextst:591', 'icu-regextst:626', @@ -288,111 +147,32 @@ protected function get_known_failures(): array { 'icu-regextst:631', 'icu-regextst:632', 'icu-regextst:633', - 'icu-regextst:705', - 'icu-regextst:706', - 'icu-regextst:709', - 'icu-regextst:710', 'icu-regextst:711', 'icu-regextst:712', 'icu-regextst:713', 'icu-regextst:714', - 'icu-regextst:715', - 'icu-regextst:716', - 'icu-regextst:717', - 'icu-regextst:718', 'icu-regextst:719', 'icu-regextst:720', - 'icu-regextst:725', - 'icu-regextst:726', - 'icu-regextst:727', - 'icu-regextst:728', 'icu-regextst:843', 'icu-regextst:844', - 'icu-regextst:931', - 'icu-regextst:932', - 'icu-regextst:933', - 'icu-regextst:934', - 'icu-regextst:935', - 'icu-regextst:936', - 'icu-regextst:941', - 'icu-regextst:942', 'icu-regextst:949', 'icu-regextst:950', 'icu-regextst:951', 'icu-regextst:952', - 'icu-regextst:953', - 'icu-regextst:954', 'icu-regextst:963', 'icu-regextst:964', - 'icu-regextst:965', - 'icu-regextst:966', 'icu-regextst:967', 'icu-regextst:968', 'icu-regextst:969', 'icu-regextst:970', - 'icu-regextst:975', - 'icu-regextst:976', - 'icu-regextst:977', - 'icu-regextst:978', 'icu-regextst:979', 'icu-regextst:980', - 'icu-regextst:981', - 'icu-regextst:982', - 'icu-regextst:985', - 'icu-regextst:986', 'icu-regextst:993', 'icu-regextst:994', 'icu-regextst:995', 'icu-regextst:996', - 'icu-regextst:997', - 'icu-regextst:998', - 'icu-regextst:999', - 'icu-regextst:1000', - 'icu-regextst:1001', - 'icu-regextst:1002', - 'icu-regextst:1003', - 'icu-regextst:1004', - 'icu-regextst:1005', - 'icu-regextst:1006', - 'icu-regextst:1007', - 'icu-regextst:1008', - 'icu-regextst:1009', - 'icu-regextst:1010', - 'icu-regextst:1011', - 'icu-regextst:1012', - 'icu-regextst:1013', - 'icu-regextst:1014', - 'icu-regextst:1015', - 'icu-regextst:1016', - 'icu-regextst:1017', - 'icu-regextst:1018', 'icu-regextst:1019', - 'icu-regextst:1020', - 'icu-regextst:1021', - 'icu-regextst:1022', - 'icu-regextst:1023', - 'icu-regextst:1024', - 'icu-regextst:1025', - 'icu-regextst:1026', - 'icu-regextst:1027', - 'icu-regextst:1028', - 'icu-regextst:1031', - 'icu-regextst:1032', - 'icu-regextst:1034', - 'icu-regextst:1035', - 'icu-regextst:1036', - 'icu-regextst:1039', - 'icu-regextst:1040', - 'icu-regextst:1041', - 'icu-regextst:1042', - 'icu-regextst:1043', - 'icu-regextst:1044', - 'icu-regextst:1047', - 'icu-regextst:1048', - 'icu-regextst:1049', - 'icu-regextst:1050', - 'icu-regextst:1051', - 'icu-regextst:1052', + 'icu-regextst:1033', 'icu-regextst:1055', 'icu-regextst:1056', 'icu-regextst:1057', @@ -451,14 +231,6 @@ protected function get_known_failures(): array { 'icu-regextst:1130', 'icu-regextst:1131', 'icu-regextst:1132', - 'icu-regextst:1133', - 'icu-regextst:1134', - 'icu-regextst:1135', - 'icu-regextst:1136', - 'icu-regextst:1137', - 'icu-regextst:1138', - 'icu-regextst:1139', - 'icu-regextst:1140', 'icu-regextst:1141', 'icu-regextst:1142', 'icu-regextst:1179', @@ -467,8 +239,6 @@ protected function get_known_failures(): array { 'icu-regextst:1182', 'icu-regextst:1185', 'icu-regextst:1186', - 'icu-regextst:1199', - 'icu-regextst:1200', 'icu-regextst:1221', 'icu-regextst:1222', 'icu-regextst:1225', @@ -483,8 +253,6 @@ protected function get_known_failures(): array { 'icu-regextst:1242', 'icu-regextst:1243', 'icu-regextst:1244', - 'icu-regextst:1247', - 'icu-regextst:1248', 'icu-regextst:1249', 'icu-regextst:1250', 'icu-regextst:1251', @@ -499,16 +267,8 @@ protected function get_known_failures(): array { 'icu-regextst:1262', 'icu-regextst:1263', 'icu-regextst:1264', - 'icu-regextst:1267', - 'icu-regextst:1268', - 'icu-regextst:1269', - 'icu-regextst:1270', - 'icu-regextst:1271', - 'icu-regextst:1272', 'icu-regextst:1301', 'icu-regextst:1302', - 'icu-regextst:1318', - 'icu-regextst:1319', 'icu-regextst:1330', 'icu-regextst:1331', 'icu-regextst:1332', @@ -519,62 +279,10 @@ protected function get_known_failures(): array { 'icu-regextst:1337', 'icu-regextst:1338', 'icu-regextst:1339', - 'icu-regextst:1364', - 'icu-regextst:1365', - 'icu-regextst:1366', - 'icu-regextst:1367', - 'icu-regextst:1370', - 'icu-regextst:1371', - 'icu-regextst:1372', - 'icu-regextst:1373', - 'icu-regextst:1374', - 'icu-regextst:1375', - 'icu-regextst:1376', - 'icu-regextst:1377', - 'icu-regextst:1378', - 'icu-regextst:1379', - 'icu-regextst:1380', - 'icu-regextst:1381', - 'icu-regextst:1382', - 'icu-regextst:1383', - 'icu-regextst:1384', - 'icu-regextst:1385', - 'icu-regextst:1386', - 'icu-regextst:1387', - 'icu-regextst:1388', - 'icu-regextst:1389', - 'icu-regextst:1390', - 'icu-regextst:1391', 'icu-regextst:1392', 'icu-regextst:1393', 'icu-regextst:1394', 'icu-regextst:1395', - 'icu-regextst:1396', - 'icu-regextst:1397', - 'icu-regextst:1398', - 'icu-regextst:1399', - 'icu-regextst:1400', - 'icu-regextst:1401', - 'icu-regextst:1402', - 'icu-regextst:1403', - 'icu-regextst:1404', - 'icu-regextst:1405', - 'icu-regextst:1406', - 'icu-regextst:1407', - 'icu-regextst:1408', - 'icu-regextst:1409', - 'icu-regextst:1410', - 'icu-regextst:1411', - 'icu-regextst:1412', - 'icu-regextst:1413', - 'icu-regextst:1414', - 'icu-regextst:1415', - 'icu-regextst:1416', - 'icu-regextst:1417', - 'icu-regextst:1418', - 'icu-regextst:1419', - 'icu-regextst:1420', - 'icu-regextst:1421', 'icu-regextst:1422', 'icu-regextst:1423', 'icu-regextst:1424', @@ -611,215 +319,16 @@ protected function get_known_failures(): array { 'icu-regextst:1457', 'icu-regextst:1458', 'icu-regextst:1459', - 'icu-regextst:1466', - 'icu-regextst:1467', - 'icu-regextst:1468', - 'icu-regextst:1469', - 'icu-regextst:1470', - 'icu-regextst:1471', - 'icu-regextst:1472', - 'icu-regextst:1473', - 'icu-regextst:1474', - 'icu-regextst:1475', - 'icu-regextst:1476', - 'icu-regextst:1477', - 'icu-regextst:1478', - 'icu-regextst:1479', - 'icu-regextst:1480', - 'icu-regextst:1481', - 'icu-regextst:1482', - 'icu-regextst:1483', - 'icu-regextst:1484', - 'icu-regextst:1485', - 'icu-regextst:1490', - 'icu-regextst:1491', 'icu-regextst:1494', 'icu-regextst:1495', 'icu-regextst:1506', 'icu-regextst:1507', 'icu-regextst:1508', 'icu-regextst:1509', - 'icu-regextst:2768', - 'icu-regextst:2769', - 'icu-regextst:2770', - 'icu-regextst:2771', - 'icu-regextst:2772', - 'icu-regextst:2773', - 'icu-regextst:2774', - 'icu-regextst:2775', - 'icu-regextst:2776', - 'icu-regextst:2777', - 'icu-regextst:2778', - 'icu-regextst:2779', - 'icu-regextst:3338', - 'icu-regextst:3339', - 'icu-regextst:3340', - 'icu-regextst:3341', - 'icu-regextst:3342', - 'icu-regextst:3343', - 'icu-regextst:3344', - 'icu-regextst:3345', - 'icu-regextst:3396', - 'icu-regextst:3397', - 'icu-regextst:3398', - 'icu-regextst:3399', - 'icu-regextst:3400', - 'icu-regextst:3401', - 'icu-regextst:3402', - 'icu-regextst:3403', 'icu-regextst:3508', 'icu-regextst:3509', - 'icu-regextst:3518', - 'icu-regextst:3519', - 'icu-regextst:3520', - 'icu-regextst:3521', - 'icu-regextst:3522', - 'icu-regextst:3523', - 'icu-regextst:3524', - 'icu-regextst:3525', - 'icu-regextst:3538', - 'icu-regextst:3539', - 'icu-regextst:3540', - 'icu-regextst:3541', - 'icu-regextst:3542', - 'icu-regextst:3543', - 'icu-regextst:3544', - 'icu-regextst:3545', - 'icu-regextst:3606', - 'icu-regextst:3607', - 'icu-regextst:3608', - 'icu-regextst:3609', - 'icu-regextst:3610', - 'icu-regextst:3611', - 'icu-regextst:3836', - 'icu-regextst:3837', - 'icu-regextst:3838', - 'icu-regextst:3839', ); - // PCRE2 rejects a range with a class at one end, like "[\d-z]". PCRE 8 reads the "-" literally. - if ( $is_pcre2 ) { - array_push( - $failures, - 'mysql-server-suite:9539', - 'mysql-server-suite:9540', - 'mysql-server-suite:9541', - 'mysql-server-suite:9542', - 'mysql-server-suite:9543', - 'mysql-server-suite:9544', - 'mysql-server-suite:9545', - 'mysql-server-suite:9546', - 'mysql-server-suite:9547', - 'mysql-server-suite:9548', - 'mysql-server-suite:9549', - 'mysql-server-suite:9550', - 'mysql-server-suite:9551', - 'mysql-server-suite:9552', - 'mysql-server-suite:9553', - 'mysql-server-suite:9554', - 'mysql-server-suite:9555', - 'mysql-server-suite:9556', - 'mysql-server-suite:9557', - 'mysql-server-suite:9558', - 'mysql-server-suite:9559', - 'mysql-server-suite:9560', - 'mysql-server-suite:9561', - 'mysql-server-suite:9562', - 'mysql-server-suite:9563', - 'mysql-server-suite:9564', - 'mysql-server-suite:9565', - 'mysql-server-suite:9566', - 'mysql-server-suite:9567', - 'mysql-server-suite:9568', - 'mysql-server-suite:9569', - 'mysql-server-suite:9570', - 'mysql-server-suite:9571', - 'mysql-server-suite:9572', - 'mysql-server-suite:9573', - 'mysql-server-suite:9574', - 'mysql-server-suite:9575', - 'mysql-server-suite:9576', - 'mysql-server-suite:9577', - 'mysql-server-suite:9578', - 'mysql-server-suite:9579', - 'mysql-server-suite:9580', - 'mysql-server-suite:9581', - 'mysql-server-suite:9582', - 'mysql-server-suite:9583', - 'mysql-server-suite:9584', - 'mysql-server-suite:9585', - 'mysql-server-suite:9586', - 'mysql-server-suite:9587', - 'mysql-server-suite:9588', - 'mysql-server-suite:9589', - 'mysql-server-suite:9590', - 'mysql-server-suite:9617', - 'mysql-server-suite:9618', - 'mysql-server-suite:9619', - 'mysql-server-suite:9620', - 'mysql-server-suite:9621', - 'mysql-server-suite:9622', - 'mysql-server-suite:9623', - 'mysql-server-suite:9624', - 'mysql-server-suite:9625', - 'mysql-server-suite:9626', - 'mysql-server-suite:9627', - 'mysql-server-suite:9628', - 'mysql-server-suite:9629', - 'mysql-server-suite:9630', - 'mysql-server-suite:9631', - 'mysql-server-suite:9632', - 'mysql-server-suite:9633', - 'mysql-server-suite:9634', - 'mysql-server-suite:9635', - 'mysql-server-suite:9636', - 'mysql-server-suite:9637', - 'mysql-server-suite:9638', - 'mysql-server-suite:9639', - 'mysql-server-suite:9640', - 'mysql-server-suite:9641', - 'mysql-server-suite:9642', - 'mysql-server-suite:9645', - 'mysql-server-suite:9646', - 'mysql-server-suite:9663', - 'mysql-server-suite:9664', - 'icu-regextst:1037', - 'icu-regextst:1038', - 'icu-regextst:2460', - 'icu-regextst:2461', - 'icu-regextst:2462', - 'icu-regextst:2463', - 'icu-regextst:2464', - 'icu-regextst:2465', - 'icu-regextst:2466', - 'icu-regextst:2467', - 'icu-regextst:2468', - 'icu-regextst:2469', - 'icu-regextst:2470', - 'icu-regextst:2471', - 'icu-regextst:3892', - 'icu-regextst:3893', - 'icu-regextst:3894', - 'icu-regextst:3895', - 'icu-regextst:3896', - 'icu-regextst:3897', - 'icu-regextst:3898', - 'icu-regextst:3899', - 'icu-regextst:3900', - 'icu-regextst:3901', - 'icu-regextst:3902', - 'icu-regextst:3903' - ); - } - - // PCRE2 rejects a set difference after a class, like "[\w--b]". PCRE 8 reads the "-" literally, which gives MySQL's results here. - if ( $is_pcre2 ) { - array_push( - $failures, - 'icu-regextst:1033' - ); - } - // PCRE 8 rejects this nested lookbehind as not fixed in length. if ( ! $is_pcre2 ) { array_push( @@ -931,6 +440,28 @@ protected function get_known_failures(): array { 'mysql-server-suite:12452', 'mysql-server-suite:12453', 'mysql-server-suite:12454', + 'icu-regextst:1370', + 'icu-regextst:1371', + 'icu-regextst:1372', + 'icu-regextst:1373', + 'icu-regextst:1374', + 'icu-regextst:1375', + 'icu-regextst:1376', + 'icu-regextst:1377', + 'icu-regextst:1404', + 'icu-regextst:1405', + 'icu-regextst:1406', + 'icu-regextst:1407', + 'icu-regextst:1412', + 'icu-regextst:1413', + 'icu-regextst:1414', + 'icu-regextst:1415', + 'icu-regextst:1416', + 'icu-regextst:1417', + 'icu-regextst:1418', + 'icu-regextst:1419', + 'icu-regextst:1420', + 'icu-regextst:1421', 'icu-regextst:1452', 'icu-regextst:1453' ); @@ -962,44 +493,19 @@ protected function get_known_failures(): array { 'icu-regextst:1294', 'icu-regextst:1295', 'icu-regextst:1296', + 'icu-regextst:1470', + 'icu-regextst:1471', + 'icu-regextst:1472', + 'icu-regextst:1473', + 'icu-regextst:1478', + 'icu-regextst:1479', + 'icu-regextst:1480', + 'icu-regextst:1481', 'icu-regextst:1504', 'icu-regextst:1505' ); } - // Before PCRE2 10.43, \w didn't match combining marks, like the vowel signs of "नमस्ते", which ICU's \w does. - if ( version_compare( $pcre_version, '10.43', '<' ) ) { - array_push( - $failures, - 'mysql-server-suite:1533', - 'mysql-server-suite:1534', - 'mysql-server-suite:1553', - 'mysql-server-suite:1554', - 'mysql-server-suite:1557', - 'mysql-server-suite:1558', - 'mysql-server-suite:1701', - 'mysql-server-suite:1702', - 'mysql-server-suite:1721', - 'mysql-server-suite:1722', - 'mysql-server-suite:1725', - 'mysql-server-suite:1726', - 'mysql-server-suite:7919', - 'mysql-server-suite:7920' - ); - } - - // Since PCRE2 10.45, a caseless \p{Lu} matches any cased letter, like ICU. - if ( version_compare( $pcre_version, '10.45', '<' ) ) { - array_push( - $failures, - 'icu-regextst:41', - 'icu-regextst:43', - 'icu-regextst:189', - 'icu-regextst:1061', - 'icu-regextst:1063' - ); - } - return $failures; } } diff --git a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Like_Tests.php b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Like_Tests.php index 0e7b7a362..1aee6bed3 100644 --- a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Like_Tests.php +++ b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Like_Tests.php @@ -14,50 +14,6 @@ protected function get_known_failures(): array { // Cases that fail in every environment. $failures = array( - 'mysql-server-suite:9591', - 'mysql-server-suite:9592', - 'mysql-server-suite:9593', - 'mysql-server-suite:9594', - 'mysql-server-suite:9595', - 'mysql-server-suite:9596', - 'mysql-server-suite:9597', - 'mysql-server-suite:9598', - 'mysql-server-suite:9599', - 'mysql-server-suite:9600', - 'mysql-server-suite:9601', - 'mysql-server-suite:9602', - 'mysql-server-suite:9603', - 'mysql-server-suite:9604', - 'mysql-server-suite:9605', - 'mysql-server-suite:9606', - 'mysql-server-suite:9607', - 'mysql-server-suite:9608', - 'mysql-server-suite:9609', - 'mysql-server-suite:9610', - 'mysql-server-suite:9611', - 'mysql-server-suite:9612', - 'mysql-server-suite:9613', - 'mysql-server-suite:9614', - 'mysql-server-suite:9615', - 'mysql-server-suite:9616', - 'mysql-server-suite:9649', - 'mysql-server-suite:9650', - 'mysql-server-suite:9651', - 'mysql-server-suite:9652', - 'mysql-server-suite:9653', - 'mysql-server-suite:9654', - 'mysql-server-suite:9655', - 'mysql-server-suite:9656', - 'mysql-server-suite:9657', - 'mysql-server-suite:9658', - 'mysql-server-suite:9659', - 'mysql-server-suite:9660', - 'mysql-server-suite:9661', - 'mysql-server-suite:9662', - 'mysql-server-suite:9665', - 'mysql-server-suite:9666', - 'mysql-server-suite:9667', - 'mysql-server-suite:9668', 'mysql-server-suite:12325', 'mysql-server-suite:12326', 'mysql-server-suite:12327', @@ -110,62 +66,6 @@ protected function get_known_failures(): array { 'mysql-server-suite:12374', 'mysql-server-suite:12375', 'mysql-server-suite:12376', - 'mysql-server-suite:12455', - 'mysql-server-suite:12456', - 'mysql-server-suite:12457', - 'mysql-server-suite:12458', - 'mysql-server-suite:12459', - 'mysql-server-suite:12460', - 'mysql-server-suite:12461', - 'mysql-server-suite:12462', - 'mysql-server-suite:12463', - 'mysql-server-suite:12464', - 'mysql-server-suite:12465', - 'mysql-server-suite:12466', - 'mysql-server-suite:12467', - 'mysql-server-suite:12468', - 'mysql-server-suite:12469', - 'mysql-server-suite:12470', - 'mysql-server-suite:12471', - 'mysql-server-suite:12472', - 'mysql-server-suite:12473', - 'mysql-server-suite:12474', - 'mysql-server-suite:12475', - 'mysql-server-suite:12476', - 'mysql-server-suite:12477', - 'mysql-server-suite:12478', - 'mysql-server-suite:12479', - 'mysql-server-suite:12480', - 'mysql-server-suite:12481', - 'mysql-server-suite:12482', - 'mysql-server-suite:12483', - 'mysql-server-suite:12484', - 'mysql-server-suite:12485', - 'mysql-server-suite:12486', - 'mysql-server-suite:12487', - 'mysql-server-suite:12488', - 'mysql-server-suite:12489', - 'mysql-server-suite:12490', - 'mysql-server-suite:12491', - 'mysql-server-suite:12492', - 'mysql-server-suite:12493', - 'mysql-server-suite:12494', - 'mysql-server-suite:12495', - 'mysql-server-suite:12496', - 'mysql-server-suite:12497', - 'mysql-server-suite:12498', - 'mysql-server-suite:12499', - 'mysql-server-suite:12500', - 'mysql-server-suite:12501', - 'mysql-server-suite:12502', - 'mysql-server-suite:12503', - 'mysql-server-suite:12504', - 'mysql-server-suite:12505', - 'mysql-server-suite:12506', - 'mysql-server-suite:12507', - 'mysql-server-suite:12508', - 'mysql-server-suite:12509', - 'mysql-server-suite:12510', 'mysql-server-suite:12589', 'mysql-server-suite:12590', 'mysql-server-suite:12591', @@ -198,10 +98,6 @@ protected function get_known_failures(): array { 'icu-regextst:147', 'icu-regextst:148', 'icu-regextst:149', - 'icu-regextst:165', - 'icu-regextst:166', - 'icu-regextst:209', - 'icu-regextst:210', 'icu-regextst:219', 'icu-regextst:220', 'icu-regextst:221', @@ -216,36 +112,10 @@ protected function get_known_failures(): array { 'icu-regextst:232', 'icu-regextst:233', 'icu-regextst:234', - 'icu-regextst:329', - 'icu-regextst:330', - 'icu-regextst:365', - 'icu-regextst:366', - 'icu-regextst:367', - 'icu-regextst:368', - 'icu-regextst:373', - 'icu-regextst:374', - 'icu-regextst:375', - 'icu-regextst:376', - 'icu-regextst:377', - 'icu-regextst:378', 'icu-regextst:383', 'icu-regextst:384', 'icu-regextst:385', 'icu-regextst:386', - 'icu-regextst:387', - 'icu-regextst:388', - 'icu-regextst:389', - 'icu-regextst:390', - 'icu-regextst:391', - 'icu-regextst:392', - 'icu-regextst:393', - 'icu-regextst:394', - 'icu-regextst:395', - 'icu-regextst:396', - 'icu-regextst:397', - 'icu-regextst:398', - 'icu-regextst:399', - 'icu-regextst:400', 'icu-regextst:520', 'icu-regextst:521', 'icu-regextst:522', @@ -266,12 +136,6 @@ protected function get_known_failures(): array { 'icu-regextst:565', 'icu-regextst:566', 'icu-regextst:567', - 'icu-regextst:580', - 'icu-regextst:581', - 'icu-regextst:582', - 'icu-regextst:583', - 'icu-regextst:584', - 'icu-regextst:585', 'icu-regextst:590', 'icu-regextst:591', 'icu-regextst:626', @@ -282,100 +146,30 @@ protected function get_known_failures(): array { 'icu-regextst:631', 'icu-regextst:632', 'icu-regextst:633', - 'icu-regextst:705', - 'icu-regextst:706', - 'icu-regextst:709', - 'icu-regextst:710', 'icu-regextst:711', 'icu-regextst:712', 'icu-regextst:713', 'icu-regextst:714', - 'icu-regextst:715', - 'icu-regextst:716', - 'icu-regextst:717', - 'icu-regextst:718', 'icu-regextst:719', 'icu-regextst:720', - 'icu-regextst:725', - 'icu-regextst:726', - 'icu-regextst:727', - 'icu-regextst:728', 'icu-regextst:843', 'icu-regextst:844', - 'icu-regextst:931', - 'icu-regextst:932', - 'icu-regextst:933', - 'icu-regextst:934', - 'icu-regextst:935', - 'icu-regextst:936', - 'icu-regextst:941', - 'icu-regextst:942', 'icu-regextst:949', 'icu-regextst:950', 'icu-regextst:951', 'icu-regextst:952', 'icu-regextst:963', 'icu-regextst:964', - 'icu-regextst:965', - 'icu-regextst:966', 'icu-regextst:967', 'icu-regextst:968', 'icu-regextst:969', 'icu-regextst:970', - 'icu-regextst:975', - 'icu-regextst:976', - 'icu-regextst:977', - 'icu-regextst:978', 'icu-regextst:979', 'icu-regextst:980', - 'icu-regextst:981', - 'icu-regextst:982', - 'icu-regextst:985', - 'icu-regextst:986', 'icu-regextst:993', 'icu-regextst:994', 'icu-regextst:995', 'icu-regextst:996', - 'icu-regextst:997', - 'icu-regextst:998', - 'icu-regextst:1001', - 'icu-regextst:1002', - 'icu-regextst:1003', - 'icu-regextst:1004', - 'icu-regextst:1005', - 'icu-regextst:1006', - 'icu-regextst:1007', - 'icu-regextst:1008', - 'icu-regextst:1009', - 'icu-regextst:1010', - 'icu-regextst:1011', - 'icu-regextst:1012', - 'icu-regextst:1015', - 'icu-regextst:1016', - 'icu-regextst:1017', - 'icu-regextst:1018', - 'icu-regextst:1019', - 'icu-regextst:1020', - 'icu-regextst:1021', - 'icu-regextst:1022', - 'icu-regextst:1023', - 'icu-regextst:1024', - 'icu-regextst:1027', - 'icu-regextst:1028', - 'icu-regextst:1031', - 'icu-regextst:1032', - 'icu-regextst:1035', - 'icu-regextst:1036', - 'icu-regextst:1039', - 'icu-regextst:1040', - 'icu-regextst:1043', - 'icu-regextst:1044', - 'icu-regextst:1047', - 'icu-regextst:1048', - 'icu-regextst:1049', - 'icu-regextst:1050', - 'icu-regextst:1051', - 'icu-regextst:1052', 'icu-regextst:1055', 'icu-regextst:1056', 'icu-regextst:1057', @@ -434,14 +228,6 @@ protected function get_known_failures(): array { 'icu-regextst:1130', 'icu-regextst:1131', 'icu-regextst:1132', - 'icu-regextst:1133', - 'icu-regextst:1134', - 'icu-regextst:1135', - 'icu-regextst:1136', - 'icu-regextst:1137', - 'icu-regextst:1138', - 'icu-regextst:1139', - 'icu-regextst:1140', 'icu-regextst:1141', 'icu-regextst:1142', 'icu-regextst:1179', @@ -450,8 +236,6 @@ protected function get_known_failures(): array { 'icu-regextst:1182', 'icu-regextst:1185', 'icu-regextst:1186', - 'icu-regextst:1199', - 'icu-regextst:1200', 'icu-regextst:1221', 'icu-regextst:1222', 'icu-regextst:1225', @@ -464,8 +248,6 @@ protected function get_known_failures(): array { 'icu-regextst:1240', 'icu-regextst:1241', 'icu-regextst:1242', - 'icu-regextst:1247', - 'icu-regextst:1248', 'icu-regextst:1249', 'icu-regextst:1250', 'icu-regextst:1251', @@ -480,8 +262,6 @@ protected function get_known_failures(): array { 'icu-regextst:1264', 'icu-regextst:1301', 'icu-regextst:1302', - 'icu-regextst:1318', - 'icu-regextst:1319', 'icu-regextst:1330', 'icu-regextst:1331', 'icu-regextst:1332', @@ -492,62 +272,10 @@ protected function get_known_failures(): array { 'icu-regextst:1337', 'icu-regextst:1338', 'icu-regextst:1339', - 'icu-regextst:1364', - 'icu-regextst:1365', - 'icu-regextst:1366', - 'icu-regextst:1367', - 'icu-regextst:1370', - 'icu-regextst:1371', - 'icu-regextst:1372', - 'icu-regextst:1373', - 'icu-regextst:1374', - 'icu-regextst:1375', - 'icu-regextst:1376', - 'icu-regextst:1377', - 'icu-regextst:1378', - 'icu-regextst:1379', - 'icu-regextst:1380', - 'icu-regextst:1381', - 'icu-regextst:1382', - 'icu-regextst:1383', - 'icu-regextst:1384', - 'icu-regextst:1385', - 'icu-regextst:1386', - 'icu-regextst:1387', - 'icu-regextst:1388', - 'icu-regextst:1389', - 'icu-regextst:1390', - 'icu-regextst:1391', 'icu-regextst:1392', 'icu-regextst:1393', 'icu-regextst:1394', 'icu-regextst:1395', - 'icu-regextst:1396', - 'icu-regextst:1397', - 'icu-regextst:1398', - 'icu-regextst:1399', - 'icu-regextst:1400', - 'icu-regextst:1401', - 'icu-regextst:1402', - 'icu-regextst:1403', - 'icu-regextst:1404', - 'icu-regextst:1405', - 'icu-regextst:1406', - 'icu-regextst:1407', - 'icu-regextst:1408', - 'icu-regextst:1409', - 'icu-regextst:1410', - 'icu-regextst:1411', - 'icu-regextst:1412', - 'icu-regextst:1413', - 'icu-regextst:1414', - 'icu-regextst:1415', - 'icu-regextst:1416', - 'icu-regextst:1417', - 'icu-regextst:1418', - 'icu-regextst:1419', - 'icu-regextst:1420', - 'icu-regextst:1421', 'icu-regextst:1422', 'icu-regextst:1423', 'icu-regextst:1424', @@ -584,218 +312,14 @@ protected function get_known_failures(): array { 'icu-regextst:1457', 'icu-regextst:1458', 'icu-regextst:1459', - 'icu-regextst:1466', - 'icu-regextst:1467', - 'icu-regextst:1468', - 'icu-regextst:1469', - 'icu-regextst:1470', - 'icu-regextst:1471', - 'icu-regextst:1472', - 'icu-regextst:1473', - 'icu-regextst:1474', - 'icu-regextst:1475', - 'icu-regextst:1476', - 'icu-regextst:1477', - 'icu-regextst:1478', - 'icu-regextst:1479', - 'icu-regextst:1480', - 'icu-regextst:1481', - 'icu-regextst:1482', - 'icu-regextst:1483', - 'icu-regextst:1484', - 'icu-regextst:1485', - 'icu-regextst:1490', - 'icu-regextst:1491', 'icu-regextst:1494', 'icu-regextst:1495', 'icu-regextst:1506', 'icu-regextst:1507', 'icu-regextst:1508', 'icu-regextst:1509', - 'icu-regextst:2768', - 'icu-regextst:2769', - 'icu-regextst:2770', - 'icu-regextst:2771', - 'icu-regextst:2772', - 'icu-regextst:2773', - 'icu-regextst:2774', - 'icu-regextst:2775', - 'icu-regextst:2776', - 'icu-regextst:2777', - 'icu-regextst:2778', - 'icu-regextst:2779', - 'icu-regextst:3338', - 'icu-regextst:3339', - 'icu-regextst:3340', - 'icu-regextst:3341', - 'icu-regextst:3342', - 'icu-regextst:3343', - 'icu-regextst:3344', - 'icu-regextst:3345', - 'icu-regextst:3396', - 'icu-regextst:3397', - 'icu-regextst:3398', - 'icu-regextst:3399', - 'icu-regextst:3400', - 'icu-regextst:3401', - 'icu-regextst:3402', - 'icu-regextst:3403', - 'icu-regextst:3518', - 'icu-regextst:3519', - 'icu-regextst:3520', - 'icu-regextst:3521', - 'icu-regextst:3522', - 'icu-regextst:3523', - 'icu-regextst:3524', - 'icu-regextst:3525', - 'icu-regextst:3538', - 'icu-regextst:3539', - 'icu-regextst:3540', - 'icu-regextst:3541', - 'icu-regextst:3542', - 'icu-regextst:3543', - 'icu-regextst:3544', - 'icu-regextst:3545', - 'icu-regextst:3606', - 'icu-regextst:3607', - 'icu-regextst:3608', - 'icu-regextst:3609', - 'icu-regextst:3610', - 'icu-regextst:3611', - 'icu-regextst:3836', - 'icu-regextst:3837', - 'icu-regextst:3838', - 'icu-regextst:3839', ); - // PCRE2 rejects a range with a class at one end, like "[\d-z]". PCRE 8 reads the "-" literally. - if ( $is_pcre2 ) { - array_push( - $failures, - 'mysql-server-suite:9539', - 'mysql-server-suite:9540', - 'mysql-server-suite:9541', - 'mysql-server-suite:9542', - 'mysql-server-suite:9543', - 'mysql-server-suite:9544', - 'mysql-server-suite:9545', - 'mysql-server-suite:9546', - 'mysql-server-suite:9547', - 'mysql-server-suite:9548', - 'mysql-server-suite:9549', - 'mysql-server-suite:9550', - 'mysql-server-suite:9551', - 'mysql-server-suite:9552', - 'mysql-server-suite:9553', - 'mysql-server-suite:9554', - 'mysql-server-suite:9555', - 'mysql-server-suite:9556', - 'mysql-server-suite:9557', - 'mysql-server-suite:9558', - 'mysql-server-suite:9559', - 'mysql-server-suite:9560', - 'mysql-server-suite:9561', - 'mysql-server-suite:9562', - 'mysql-server-suite:9563', - 'mysql-server-suite:9564', - 'mysql-server-suite:9565', - 'mysql-server-suite:9566', - 'mysql-server-suite:9567', - 'mysql-server-suite:9568', - 'mysql-server-suite:9569', - 'mysql-server-suite:9570', - 'mysql-server-suite:9571', - 'mysql-server-suite:9572', - 'mysql-server-suite:9573', - 'mysql-server-suite:9574', - 'mysql-server-suite:9575', - 'mysql-server-suite:9576', - 'mysql-server-suite:9577', - 'mysql-server-suite:9578', - 'mysql-server-suite:9579', - 'mysql-server-suite:9580', - 'mysql-server-suite:9581', - 'mysql-server-suite:9582', - 'mysql-server-suite:9583', - 'mysql-server-suite:9584', - 'mysql-server-suite:9585', - 'mysql-server-suite:9586', - 'mysql-server-suite:9587', - 'mysql-server-suite:9588', - 'mysql-server-suite:9589', - 'mysql-server-suite:9590', - 'mysql-server-suite:9617', - 'mysql-server-suite:9618', - 'mysql-server-suite:9619', - 'mysql-server-suite:9620', - 'mysql-server-suite:9621', - 'mysql-server-suite:9622', - 'mysql-server-suite:9623', - 'mysql-server-suite:9624', - 'mysql-server-suite:9625', - 'mysql-server-suite:9626', - 'mysql-server-suite:9627', - 'mysql-server-suite:9628', - 'mysql-server-suite:9629', - 'mysql-server-suite:9630', - 'mysql-server-suite:9631', - 'mysql-server-suite:9632', - 'mysql-server-suite:9633', - 'mysql-server-suite:9634', - 'mysql-server-suite:9635', - 'mysql-server-suite:9636', - 'mysql-server-suite:9637', - 'mysql-server-suite:9638', - 'mysql-server-suite:9639', - 'mysql-server-suite:9640', - 'mysql-server-suite:9641', - 'mysql-server-suite:9642', - 'mysql-server-suite:9643', - 'mysql-server-suite:9644', - 'mysql-server-suite:9645', - 'mysql-server-suite:9646', - 'mysql-server-suite:9647', - 'mysql-server-suite:9648', - 'mysql-server-suite:9663', - 'mysql-server-suite:9664', - 'icu-regextst:1037', - 'icu-regextst:1038', - 'icu-regextst:2460', - 'icu-regextst:2461', - 'icu-regextst:2462', - 'icu-regextst:2463', - 'icu-regextst:2464', - 'icu-regextst:2465', - 'icu-regextst:2466', - 'icu-regextst:2467', - 'icu-regextst:2468', - 'icu-regextst:2469', - 'icu-regextst:2470', - 'icu-regextst:2471', - 'icu-regextst:3892', - 'icu-regextst:3893', - 'icu-regextst:3894', - 'icu-regextst:3895', - 'icu-regextst:3896', - 'icu-regextst:3897', - 'icu-regextst:3898', - 'icu-regextst:3899', - 'icu-regextst:3900', - 'icu-regextst:3901', - 'icu-regextst:3902', - 'icu-regextst:3903' - ); - } - - // PCRE2 rejects a set difference after a class, like "[\w--b]". PCRE 8 reads the "-" literally, which gives MySQL's results here. - if ( $is_pcre2 ) { - array_push( - $failures, - 'icu-regextst:1033', - 'icu-regextst:1034' - ); - } - // PCRE 8 rejects this nested lookbehind as not fixed in length. if ( ! $is_pcre2 ) { array_push( @@ -898,6 +422,28 @@ protected function get_known_failures(): array { 'mysql-server-suite:12452', 'mysql-server-suite:12453', 'mysql-server-suite:12454', + 'icu-regextst:1370', + 'icu-regextst:1371', + 'icu-regextst:1372', + 'icu-regextst:1373', + 'icu-regextst:1374', + 'icu-regextst:1375', + 'icu-regextst:1376', + 'icu-regextst:1377', + 'icu-regextst:1404', + 'icu-regextst:1405', + 'icu-regextst:1406', + 'icu-regextst:1407', + 'icu-regextst:1412', + 'icu-regextst:1413', + 'icu-regextst:1414', + 'icu-regextst:1415', + 'icu-regextst:1416', + 'icu-regextst:1417', + 'icu-regextst:1418', + 'icu-regextst:1419', + 'icu-regextst:1420', + 'icu-regextst:1421', 'icu-regextst:1452', 'icu-regextst:1453' ); @@ -929,33 +475,19 @@ protected function get_known_failures(): array { 'icu-regextst:1294', 'icu-regextst:1295', 'icu-regextst:1296', + 'icu-regextst:1470', + 'icu-regextst:1471', + 'icu-regextst:1472', + 'icu-regextst:1473', + 'icu-regextst:1478', + 'icu-regextst:1479', + 'icu-regextst:1480', + 'icu-regextst:1481', 'icu-regextst:1504', 'icu-regextst:1505' ); } - // Before PCRE2 10.43, \w didn't match combining marks, like the vowel signs of "नमस्ते", which ICU's \w does. - if ( version_compare( $pcre_version, '10.43', '<' ) ) { - array_push( - $failures, - 'mysql-server-suite:1533', - 'mysql-server-suite:1534', - 'mysql-server-suite:1701', - 'mysql-server-suite:1702', - 'mysql-server-suite:7923', - 'mysql-server-suite:7924' - ); - } - - // Since PCRE2 10.45, a caseless \p{Lu} matches any cased letter, like ICU. - if ( version_compare( $pcre_version, '10.45', '<' ) ) { - array_push( - $failures, - 'icu-regextst:41', - 'icu-regextst:43' - ); - } - return $failures; } } diff --git a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Replace_Tests.php b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Replace_Tests.php index 4eae03f59..2f02a3ef7 100644 --- a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Replace_Tests.php +++ b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Replace_Tests.php @@ -14,66 +14,8 @@ protected function get_known_failures(): array { // Cases that fail in every environment. $failures = array( - 'mysql-server-suite:1529', - 'mysql-server-suite:1530', - 'mysql-server-suite:1557', - 'mysql-server-suite:1558', - 'mysql-server-suite:1697', - 'mysql-server-suite:1698', - 'mysql-server-suite:1725', - 'mysql-server-suite:1726', - 'mysql-server-suite:7923', - 'mysql-server-suite:7924', 'mysql-server-suite:8349', 'mysql-server-suite:8350', - 'mysql-server-suite:9591', - 'mysql-server-suite:9592', - 'mysql-server-suite:9593', - 'mysql-server-suite:9594', - 'mysql-server-suite:9595', - 'mysql-server-suite:9596', - 'mysql-server-suite:9597', - 'mysql-server-suite:9598', - 'mysql-server-suite:9599', - 'mysql-server-suite:9600', - 'mysql-server-suite:9601', - 'mysql-server-suite:9602', - 'mysql-server-suite:9603', - 'mysql-server-suite:9604', - 'mysql-server-suite:9605', - 'mysql-server-suite:9606', - 'mysql-server-suite:9607', - 'mysql-server-suite:9608', - 'mysql-server-suite:9609', - 'mysql-server-suite:9610', - 'mysql-server-suite:9611', - 'mysql-server-suite:9612', - 'mysql-server-suite:9613', - 'mysql-server-suite:9614', - 'mysql-server-suite:9615', - 'mysql-server-suite:9616', - 'mysql-server-suite:9643', - 'mysql-server-suite:9644', - 'mysql-server-suite:9647', - 'mysql-server-suite:9648', - 'mysql-server-suite:9649', - 'mysql-server-suite:9650', - 'mysql-server-suite:9651', - 'mysql-server-suite:9652', - 'mysql-server-suite:9653', - 'mysql-server-suite:9654', - 'mysql-server-suite:9655', - 'mysql-server-suite:9656', - 'mysql-server-suite:9657', - 'mysql-server-suite:9658', - 'mysql-server-suite:9659', - 'mysql-server-suite:9660', - 'mysql-server-suite:9661', - 'mysql-server-suite:9662', - 'mysql-server-suite:9665', - 'mysql-server-suite:9666', - 'mysql-server-suite:9667', - 'mysql-server-suite:9668', 'mysql-server-suite:12325', 'mysql-server-suite:12326', 'mysql-server-suite:12327', @@ -126,62 +68,8 @@ protected function get_known_failures(): array { 'mysql-server-suite:12374', 'mysql-server-suite:12375', 'mysql-server-suite:12376', - 'mysql-server-suite:12455', - 'mysql-server-suite:12456', - 'mysql-server-suite:12457', - 'mysql-server-suite:12458', - 'mysql-server-suite:12459', - 'mysql-server-suite:12460', - 'mysql-server-suite:12461', - 'mysql-server-suite:12462', - 'mysql-server-suite:12463', - 'mysql-server-suite:12464', - 'mysql-server-suite:12465', - 'mysql-server-suite:12466', - 'mysql-server-suite:12467', - 'mysql-server-suite:12468', - 'mysql-server-suite:12469', - 'mysql-server-suite:12470', - 'mysql-server-suite:12471', - 'mysql-server-suite:12472', - 'mysql-server-suite:12473', - 'mysql-server-suite:12474', - 'mysql-server-suite:12475', - 'mysql-server-suite:12476', - 'mysql-server-suite:12477', - 'mysql-server-suite:12478', 'mysql-server-suite:12479', - 'mysql-server-suite:12480', - 'mysql-server-suite:12481', - 'mysql-server-suite:12482', - 'mysql-server-suite:12483', - 'mysql-server-suite:12484', - 'mysql-server-suite:12485', - 'mysql-server-suite:12486', - 'mysql-server-suite:12487', - 'mysql-server-suite:12488', - 'mysql-server-suite:12489', - 'mysql-server-suite:12490', - 'mysql-server-suite:12491', - 'mysql-server-suite:12492', - 'mysql-server-suite:12493', - 'mysql-server-suite:12494', - 'mysql-server-suite:12495', - 'mysql-server-suite:12496', - 'mysql-server-suite:12497', - 'mysql-server-suite:12498', - 'mysql-server-suite:12499', - 'mysql-server-suite:12500', - 'mysql-server-suite:12501', - 'mysql-server-suite:12502', - 'mysql-server-suite:12503', - 'mysql-server-suite:12504', - 'mysql-server-suite:12505', - 'mysql-server-suite:12506', 'mysql-server-suite:12507', - 'mysql-server-suite:12508', - 'mysql-server-suite:12509', - 'mysql-server-suite:12510', 'mysql-server-suite:12579', 'mysql-server-suite:12580', 'mysql-server-suite:12589', @@ -216,10 +104,6 @@ protected function get_known_failures(): array { 'icu-regextst:147', 'icu-regextst:148', 'icu-regextst:149', - 'icu-regextst:165', - 'icu-regextst:166', - 'icu-regextst:209', - 'icu-regextst:210', 'icu-regextst:217', 'icu-regextst:218', 'icu-regextst:219', @@ -236,36 +120,10 @@ protected function get_known_failures(): array { 'icu-regextst:232', 'icu-regextst:233', 'icu-regextst:234', - 'icu-regextst:329', - 'icu-regextst:330', - 'icu-regextst:365', - 'icu-regextst:366', - 'icu-regextst:367', - 'icu-regextst:368', - 'icu-regextst:373', - 'icu-regextst:374', - 'icu-regextst:375', - 'icu-regextst:376', - 'icu-regextst:377', - 'icu-regextst:378', 'icu-regextst:383', 'icu-regextst:384', 'icu-regextst:385', 'icu-regextst:386', - 'icu-regextst:387', - 'icu-regextst:388', - 'icu-regextst:389', - 'icu-regextst:390', - 'icu-regextst:391', - 'icu-regextst:392', - 'icu-regextst:393', - 'icu-regextst:394', - 'icu-regextst:395', - 'icu-regextst:396', - 'icu-regextst:397', - 'icu-regextst:398', - 'icu-regextst:399', - 'icu-regextst:400', 'icu-regextst:520', 'icu-regextst:521', 'icu-regextst:522', @@ -286,12 +144,6 @@ protected function get_known_failures(): array { 'icu-regextst:565', 'icu-regextst:566', 'icu-regextst:567', - 'icu-regextst:580', - 'icu-regextst:581', - 'icu-regextst:582', - 'icu-regextst:583', - 'icu-regextst:584', - 'icu-regextst:585', 'icu-regextst:590', 'icu-regextst:591', 'icu-regextst:626', @@ -302,24 +154,12 @@ protected function get_known_failures(): array { 'icu-regextst:631', 'icu-regextst:632', 'icu-regextst:633', - 'icu-regextst:705', - 'icu-regextst:706', - 'icu-regextst:709', - 'icu-regextst:710', 'icu-regextst:711', 'icu-regextst:712', 'icu-regextst:713', 'icu-regextst:714', - 'icu-regextst:715', - 'icu-regextst:716', - 'icu-regextst:717', - 'icu-regextst:718', 'icu-regextst:719', 'icu-regextst:720', - 'icu-regextst:725', - 'icu-regextst:726', - 'icu-regextst:727', - 'icu-regextst:728', 'icu-regextst:843', 'icu-regextst:844', 'icu-regextst:879', @@ -329,91 +169,24 @@ protected function get_known_failures(): array { 'icu-regextst:895', 'icu-regextst:896', 'icu-regextst:919', - 'icu-regextst:931', - 'icu-regextst:932', - 'icu-regextst:933', - 'icu-regextst:934', - 'icu-regextst:935', - 'icu-regextst:936', - 'icu-regextst:941', - 'icu-regextst:942', 'icu-regextst:949', 'icu-regextst:950', 'icu-regextst:951', 'icu-regextst:952', - 'icu-regextst:953', - 'icu-regextst:954', 'icu-regextst:963', 'icu-regextst:964', - 'icu-regextst:965', - 'icu-regextst:966', 'icu-regextst:967', 'icu-regextst:968', 'icu-regextst:969', 'icu-regextst:970', - 'icu-regextst:975', - 'icu-regextst:976', - 'icu-regextst:977', - 'icu-regextst:978', 'icu-regextst:979', 'icu-regextst:980', - 'icu-regextst:981', - 'icu-regextst:982', - 'icu-regextst:985', - 'icu-regextst:986', 'icu-regextst:993', 'icu-regextst:994', 'icu-regextst:995', 'icu-regextst:996', - 'icu-regextst:997', - 'icu-regextst:998', - 'icu-regextst:999', - 'icu-regextst:1000', - 'icu-regextst:1001', - 'icu-regextst:1002', - 'icu-regextst:1003', - 'icu-regextst:1004', - 'icu-regextst:1005', - 'icu-regextst:1006', - 'icu-regextst:1007', - 'icu-regextst:1008', - 'icu-regextst:1009', - 'icu-regextst:1010', - 'icu-regextst:1011', - 'icu-regextst:1012', - 'icu-regextst:1013', - 'icu-regextst:1014', - 'icu-regextst:1015', - 'icu-regextst:1016', - 'icu-regextst:1017', - 'icu-regextst:1018', 'icu-regextst:1019', - 'icu-regextst:1020', - 'icu-regextst:1021', - 'icu-regextst:1022', - 'icu-regextst:1023', - 'icu-regextst:1024', - 'icu-regextst:1025', - 'icu-regextst:1026', - 'icu-regextst:1027', - 'icu-regextst:1028', - 'icu-regextst:1031', - 'icu-regextst:1032', - 'icu-regextst:1034', - 'icu-regextst:1035', - 'icu-regextst:1036', - 'icu-regextst:1039', - 'icu-regextst:1040', - 'icu-regextst:1041', - 'icu-regextst:1042', - 'icu-regextst:1043', - 'icu-regextst:1044', - 'icu-regextst:1047', - 'icu-regextst:1048', - 'icu-regextst:1049', - 'icu-regextst:1050', - 'icu-regextst:1051', - 'icu-regextst:1052', + 'icu-regextst:1033', 'icu-regextst:1055', 'icu-regextst:1056', 'icu-regextst:1057', @@ -472,26 +245,14 @@ protected function get_known_failures(): array { 'icu-regextst:1130', 'icu-regextst:1131', 'icu-regextst:1132', - 'icu-regextst:1133', - 'icu-regextst:1134', - 'icu-regextst:1135', - 'icu-regextst:1136', - 'icu-regextst:1137', - 'icu-regextst:1138', - 'icu-regextst:1139', - 'icu-regextst:1140', 'icu-regextst:1141', 'icu-regextst:1142', - 'icu-regextst:1170', - 'icu-regextst:1171', 'icu-regextst:1179', 'icu-regextst:1180', 'icu-regextst:1181', 'icu-regextst:1182', 'icu-regextst:1185', 'icu-regextst:1186', - 'icu-regextst:1199', - 'icu-regextst:1200', 'icu-regextst:1221', 'icu-regextst:1222', 'icu-regextst:1225', @@ -506,8 +267,6 @@ protected function get_known_failures(): array { 'icu-regextst:1242', 'icu-regextst:1243', 'icu-regextst:1244', - 'icu-regextst:1247', - 'icu-regextst:1248', 'icu-regextst:1249', 'icu-regextst:1250', 'icu-regextst:1251', @@ -522,16 +281,8 @@ protected function get_known_failures(): array { 'icu-regextst:1262', 'icu-regextst:1263', 'icu-regextst:1264', - 'icu-regextst:1267', - 'icu-regextst:1268', - 'icu-regextst:1269', - 'icu-regextst:1270', - 'icu-regextst:1271', - 'icu-regextst:1272', 'icu-regextst:1301', 'icu-regextst:1302', - 'icu-regextst:1318', - 'icu-regextst:1319', 'icu-regextst:1330', 'icu-regextst:1331', 'icu-regextst:1332', @@ -542,62 +293,10 @@ protected function get_known_failures(): array { 'icu-regextst:1337', 'icu-regextst:1338', 'icu-regextst:1339', - 'icu-regextst:1364', - 'icu-regextst:1365', - 'icu-regextst:1366', - 'icu-regextst:1367', - 'icu-regextst:1370', - 'icu-regextst:1371', - 'icu-regextst:1372', - 'icu-regextst:1373', - 'icu-regextst:1374', - 'icu-regextst:1375', - 'icu-regextst:1376', - 'icu-regextst:1377', - 'icu-regextst:1378', - 'icu-regextst:1379', - 'icu-regextst:1380', - 'icu-regextst:1381', - 'icu-regextst:1382', - 'icu-regextst:1383', - 'icu-regextst:1384', - 'icu-regextst:1385', - 'icu-regextst:1386', - 'icu-regextst:1387', - 'icu-regextst:1388', - 'icu-regextst:1389', - 'icu-regextst:1390', - 'icu-regextst:1391', 'icu-regextst:1392', 'icu-regextst:1393', 'icu-regextst:1394', 'icu-regextst:1395', - 'icu-regextst:1396', - 'icu-regextst:1397', - 'icu-regextst:1398', - 'icu-regextst:1399', - 'icu-regextst:1400', - 'icu-regextst:1401', - 'icu-regextst:1402', - 'icu-regextst:1403', - 'icu-regextst:1404', - 'icu-regextst:1405', - 'icu-regextst:1406', - 'icu-regextst:1407', - 'icu-regextst:1408', - 'icu-regextst:1409', - 'icu-regextst:1410', - 'icu-regextst:1411', - 'icu-regextst:1412', - 'icu-regextst:1413', - 'icu-regextst:1414', - 'icu-regextst:1415', - 'icu-regextst:1416', - 'icu-regextst:1417', - 'icu-regextst:1418', - 'icu-regextst:1419', - 'icu-regextst:1420', - 'icu-regextst:1421', 'icu-regextst:1422', 'icu-regextst:1423', 'icu-regextst:1424', @@ -634,28 +333,6 @@ protected function get_known_failures(): array { 'icu-regextst:1457', 'icu-regextst:1458', 'icu-regextst:1459', - 'icu-regextst:1466', - 'icu-regextst:1467', - 'icu-regextst:1468', - 'icu-regextst:1469', - 'icu-regextst:1470', - 'icu-regextst:1471', - 'icu-regextst:1472', - 'icu-regextst:1473', - 'icu-regextst:1474', - 'icu-regextst:1475', - 'icu-regextst:1476', - 'icu-regextst:1477', - 'icu-regextst:1478', - 'icu-regextst:1479', - 'icu-regextst:1480', - 'icu-regextst:1481', - 'icu-regextst:1482', - 'icu-regextst:1483', - 'icu-regextst:1484', - 'icu-regextst:1485', - 'icu-regextst:1490', - 'icu-regextst:1491', 'icu-regextst:1494', 'icu-regextst:1495', 'icu-regextst:1506', @@ -664,187 +341,10 @@ protected function get_known_failures(): array { 'icu-regextst:1509', 'icu-regextst:1872', 'icu-regextst:1873', - 'icu-regextst:2768', - 'icu-regextst:2769', - 'icu-regextst:2770', - 'icu-regextst:2771', - 'icu-regextst:2772', - 'icu-regextst:2773', - 'icu-regextst:2774', - 'icu-regextst:2775', - 'icu-regextst:2776', - 'icu-regextst:2777', - 'icu-regextst:2778', - 'icu-regextst:2779', - 'icu-regextst:3338', - 'icu-regextst:3339', - 'icu-regextst:3340', - 'icu-regextst:3341', - 'icu-regextst:3342', - 'icu-regextst:3343', - 'icu-regextst:3344', - 'icu-regextst:3345', - 'icu-regextst:3396', - 'icu-regextst:3397', - 'icu-regextst:3398', - 'icu-regextst:3399', - 'icu-regextst:3400', - 'icu-regextst:3401', - 'icu-regextst:3402', - 'icu-regextst:3403', 'icu-regextst:3508', 'icu-regextst:3509', - 'icu-regextst:3518', - 'icu-regextst:3519', - 'icu-regextst:3520', - 'icu-regextst:3521', - 'icu-regextst:3522', - 'icu-regextst:3523', - 'icu-regextst:3524', - 'icu-regextst:3525', - 'icu-regextst:3538', - 'icu-regextst:3539', - 'icu-regextst:3540', - 'icu-regextst:3541', - 'icu-regextst:3542', - 'icu-regextst:3543', - 'icu-regextst:3544', - 'icu-regextst:3545', - 'icu-regextst:3606', - 'icu-regextst:3607', - 'icu-regextst:3608', - 'icu-regextst:3609', - 'icu-regextst:3610', - 'icu-regextst:3611', - 'icu-regextst:3836', - 'icu-regextst:3837', - 'icu-regextst:3838', - 'icu-regextst:3839', ); - // PCRE2 rejects a range with a class at one end, like "[\d-z]". PCRE 8 reads the "-" literally. - if ( $is_pcre2 ) { - array_push( - $failures, - 'mysql-server-suite:9539', - 'mysql-server-suite:9540', - 'mysql-server-suite:9541', - 'mysql-server-suite:9542', - 'mysql-server-suite:9543', - 'mysql-server-suite:9544', - 'mysql-server-suite:9545', - 'mysql-server-suite:9546', - 'mysql-server-suite:9547', - 'mysql-server-suite:9548', - 'mysql-server-suite:9549', - 'mysql-server-suite:9550', - 'mysql-server-suite:9551', - 'mysql-server-suite:9552', - 'mysql-server-suite:9553', - 'mysql-server-suite:9554', - 'mysql-server-suite:9555', - 'mysql-server-suite:9556', - 'mysql-server-suite:9557', - 'mysql-server-suite:9558', - 'mysql-server-suite:9559', - 'mysql-server-suite:9560', - 'mysql-server-suite:9561', - 'mysql-server-suite:9562', - 'mysql-server-suite:9563', - 'mysql-server-suite:9564', - 'mysql-server-suite:9565', - 'mysql-server-suite:9566', - 'mysql-server-suite:9567', - 'mysql-server-suite:9568', - 'mysql-server-suite:9569', - 'mysql-server-suite:9570', - 'mysql-server-suite:9571', - 'mysql-server-suite:9572', - 'mysql-server-suite:9573', - 'mysql-server-suite:9574', - 'mysql-server-suite:9575', - 'mysql-server-suite:9576', - 'mysql-server-suite:9577', - 'mysql-server-suite:9578', - 'mysql-server-suite:9579', - 'mysql-server-suite:9580', - 'mysql-server-suite:9581', - 'mysql-server-suite:9582', - 'mysql-server-suite:9583', - 'mysql-server-suite:9584', - 'mysql-server-suite:9585', - 'mysql-server-suite:9586', - 'mysql-server-suite:9587', - 'mysql-server-suite:9588', - 'mysql-server-suite:9589', - 'mysql-server-suite:9590', - 'mysql-server-suite:9617', - 'mysql-server-suite:9618', - 'mysql-server-suite:9619', - 'mysql-server-suite:9620', - 'mysql-server-suite:9621', - 'mysql-server-suite:9622', - 'mysql-server-suite:9623', - 'mysql-server-suite:9624', - 'mysql-server-suite:9625', - 'mysql-server-suite:9626', - 'mysql-server-suite:9627', - 'mysql-server-suite:9628', - 'mysql-server-suite:9629', - 'mysql-server-suite:9630', - 'mysql-server-suite:9631', - 'mysql-server-suite:9632', - 'mysql-server-suite:9633', - 'mysql-server-suite:9634', - 'mysql-server-suite:9635', - 'mysql-server-suite:9636', - 'mysql-server-suite:9637', - 'mysql-server-suite:9638', - 'mysql-server-suite:9639', - 'mysql-server-suite:9640', - 'mysql-server-suite:9641', - 'mysql-server-suite:9642', - 'mysql-server-suite:9645', - 'mysql-server-suite:9646', - 'mysql-server-suite:9663', - 'mysql-server-suite:9664', - 'icu-regextst:1037', - 'icu-regextst:1038', - 'icu-regextst:2460', - 'icu-regextst:2461', - 'icu-regextst:2462', - 'icu-regextst:2463', - 'icu-regextst:2464', - 'icu-regextst:2465', - 'icu-regextst:2466', - 'icu-regextst:2467', - 'icu-regextst:2468', - 'icu-regextst:2469', - 'icu-regextst:2470', - 'icu-regextst:2471', - 'icu-regextst:3892', - 'icu-regextst:3893', - 'icu-regextst:3894', - 'icu-regextst:3895', - 'icu-regextst:3896', - 'icu-regextst:3897', - 'icu-regextst:3898', - 'icu-regextst:3899', - 'icu-regextst:3900', - 'icu-regextst:3901', - 'icu-regextst:3902', - 'icu-regextst:3903' - ); - } - - // PCRE2 rejects a set difference after a class, like "[\w--b]". PCRE 8 reads the "-" literally, which gives MySQL's results here. - if ( $is_pcre2 ) { - array_push( - $failures, - 'icu-regextst:1033' - ); - } - // PCRE 8 rejects this nested lookbehind as not fixed in length. if ( ! $is_pcre2 ) { array_push( @@ -960,6 +460,28 @@ protected function get_known_failures(): array { 'mysql-server-suite:12452', 'mysql-server-suite:12453', 'mysql-server-suite:12454', + 'icu-regextst:1370', + 'icu-regextst:1371', + 'icu-regextst:1372', + 'icu-regextst:1373', + 'icu-regextst:1374', + 'icu-regextst:1375', + 'icu-regextst:1376', + 'icu-regextst:1377', + 'icu-regextst:1404', + 'icu-regextst:1405', + 'icu-regextst:1406', + 'icu-regextst:1407', + 'icu-regextst:1412', + 'icu-regextst:1413', + 'icu-regextst:1414', + 'icu-regextst:1415', + 'icu-regextst:1416', + 'icu-regextst:1417', + 'icu-regextst:1418', + 'icu-regextst:1419', + 'icu-regextst:1420', + 'icu-regextst:1421', 'icu-regextst:1452', 'icu-regextst:1453' ); @@ -991,48 +513,19 @@ protected function get_known_failures(): array { 'icu-regextst:1294', 'icu-regextst:1295', 'icu-regextst:1296', + 'icu-regextst:1470', + 'icu-regextst:1471', + 'icu-regextst:1472', + 'icu-regextst:1473', + 'icu-regextst:1478', + 'icu-regextst:1479', + 'icu-regextst:1480', + 'icu-regextst:1481', 'icu-regextst:1504', 'icu-regextst:1505' ); } - // Before PCRE2 10.43, \w didn't match combining marks, like the vowel signs of "नमस्ते", which ICU's \w does. - if ( version_compare( $pcre_version, '10.43', '<' ) ) { - array_push( - $failures, - 'mysql-server-suite:1525', - 'mysql-server-suite:1526', - 'mysql-server-suite:1533', - 'mysql-server-suite:1534', - 'mysql-server-suite:1553', - 'mysql-server-suite:1554', - 'mysql-server-suite:1561', - 'mysql-server-suite:1562', - 'mysql-server-suite:1693', - 'mysql-server-suite:1694', - 'mysql-server-suite:1701', - 'mysql-server-suite:1702', - 'mysql-server-suite:1721', - 'mysql-server-suite:1722', - 'mysql-server-suite:1729', - 'mysql-server-suite:1730', - 'mysql-server-suite:7919', - 'mysql-server-suite:7920' - ); - } - - // Since PCRE2 10.45, a caseless \p{Lu} matches any cased letter, like ICU. - if ( version_compare( $pcre_version, '10.45', '<' ) ) { - array_push( - $failures, - 'icu-regextst:41', - 'icu-regextst:43', - 'icu-regextst:189', - 'icu-regextst:1061', - 'icu-regextst:1063' - ); - } - return $failures; } } diff --git a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Substr_Tests.php b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Substr_Tests.php index ae48e3237..fde039a4a 100644 --- a/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Substr_Tests.php +++ b/packages/mysql-on-sqlite/tests/regexp/WP_MySQL_On_SQLite_Regexp_Substr_Tests.php @@ -14,56 +14,6 @@ protected function get_known_failures(): array { // Cases that fail in every environment. $failures = array( - 'mysql-server-suite:7923', - 'mysql-server-suite:7924', - 'mysql-server-suite:9591', - 'mysql-server-suite:9592', - 'mysql-server-suite:9593', - 'mysql-server-suite:9594', - 'mysql-server-suite:9595', - 'mysql-server-suite:9596', - 'mysql-server-suite:9597', - 'mysql-server-suite:9598', - 'mysql-server-suite:9599', - 'mysql-server-suite:9600', - 'mysql-server-suite:9601', - 'mysql-server-suite:9602', - 'mysql-server-suite:9603', - 'mysql-server-suite:9604', - 'mysql-server-suite:9605', - 'mysql-server-suite:9606', - 'mysql-server-suite:9607', - 'mysql-server-suite:9608', - 'mysql-server-suite:9609', - 'mysql-server-suite:9610', - 'mysql-server-suite:9611', - 'mysql-server-suite:9612', - 'mysql-server-suite:9613', - 'mysql-server-suite:9614', - 'mysql-server-suite:9615', - 'mysql-server-suite:9616', - 'mysql-server-suite:9643', - 'mysql-server-suite:9644', - 'mysql-server-suite:9647', - 'mysql-server-suite:9648', - 'mysql-server-suite:9649', - 'mysql-server-suite:9650', - 'mysql-server-suite:9651', - 'mysql-server-suite:9652', - 'mysql-server-suite:9653', - 'mysql-server-suite:9654', - 'mysql-server-suite:9655', - 'mysql-server-suite:9656', - 'mysql-server-suite:9657', - 'mysql-server-suite:9658', - 'mysql-server-suite:9659', - 'mysql-server-suite:9660', - 'mysql-server-suite:9661', - 'mysql-server-suite:9662', - 'mysql-server-suite:9665', - 'mysql-server-suite:9666', - 'mysql-server-suite:9667', - 'mysql-server-suite:9668', 'mysql-server-suite:12325', 'mysql-server-suite:12326', 'mysql-server-suite:12327', @@ -116,62 +66,7 @@ protected function get_known_failures(): array { 'mysql-server-suite:12374', 'mysql-server-suite:12375', 'mysql-server-suite:12376', - 'mysql-server-suite:12455', - 'mysql-server-suite:12456', - 'mysql-server-suite:12457', - 'mysql-server-suite:12458', - 'mysql-server-suite:12459', - 'mysql-server-suite:12460', - 'mysql-server-suite:12461', - 'mysql-server-suite:12462', - 'mysql-server-suite:12463', - 'mysql-server-suite:12464', - 'mysql-server-suite:12465', - 'mysql-server-suite:12466', - 'mysql-server-suite:12467', - 'mysql-server-suite:12468', - 'mysql-server-suite:12469', - 'mysql-server-suite:12470', - 'mysql-server-suite:12471', - 'mysql-server-suite:12472', - 'mysql-server-suite:12473', - 'mysql-server-suite:12474', - 'mysql-server-suite:12475', - 'mysql-server-suite:12476', - 'mysql-server-suite:12477', - 'mysql-server-suite:12478', 'mysql-server-suite:12479', - 'mysql-server-suite:12480', - 'mysql-server-suite:12481', - 'mysql-server-suite:12482', - 'mysql-server-suite:12483', - 'mysql-server-suite:12484', - 'mysql-server-suite:12485', - 'mysql-server-suite:12486', - 'mysql-server-suite:12487', - 'mysql-server-suite:12488', - 'mysql-server-suite:12489', - 'mysql-server-suite:12490', - 'mysql-server-suite:12491', - 'mysql-server-suite:12492', - 'mysql-server-suite:12493', - 'mysql-server-suite:12494', - 'mysql-server-suite:12495', - 'mysql-server-suite:12496', - 'mysql-server-suite:12497', - 'mysql-server-suite:12498', - 'mysql-server-suite:12499', - 'mysql-server-suite:12500', - 'mysql-server-suite:12501', - 'mysql-server-suite:12502', - 'mysql-server-suite:12503', - 'mysql-server-suite:12504', - 'mysql-server-suite:12505', - 'mysql-server-suite:12506', - 'mysql-server-suite:12507', - 'mysql-server-suite:12508', - 'mysql-server-suite:12509', - 'mysql-server-suite:12510', 'mysql-server-suite:12589', 'mysql-server-suite:12590', 'mysql-server-suite:12591', @@ -204,10 +99,6 @@ protected function get_known_failures(): array { 'icu-regextst:147', 'icu-regextst:148', 'icu-regextst:149', - 'icu-regextst:165', - 'icu-regextst:166', - 'icu-regextst:209', - 'icu-regextst:210', 'icu-regextst:219', 'icu-regextst:220', 'icu-regextst:221', @@ -222,36 +113,10 @@ protected function get_known_failures(): array { 'icu-regextst:232', 'icu-regextst:233', 'icu-regextst:234', - 'icu-regextst:329', - 'icu-regextst:330', - 'icu-regextst:365', - 'icu-regextst:366', - 'icu-regextst:367', - 'icu-regextst:368', - 'icu-regextst:373', - 'icu-regextst:374', - 'icu-regextst:375', - 'icu-regextst:376', - 'icu-regextst:377', - 'icu-regextst:378', 'icu-regextst:383', 'icu-regextst:384', 'icu-regextst:385', 'icu-regextst:386', - 'icu-regextst:387', - 'icu-regextst:388', - 'icu-regextst:389', - 'icu-regextst:390', - 'icu-regextst:391', - 'icu-regextst:392', - 'icu-regextst:393', - 'icu-regextst:394', - 'icu-regextst:395', - 'icu-regextst:396', - 'icu-regextst:397', - 'icu-regextst:398', - 'icu-regextst:399', - 'icu-regextst:400', 'icu-regextst:520', 'icu-regextst:521', 'icu-regextst:522', @@ -272,12 +137,6 @@ protected function get_known_failures(): array { 'icu-regextst:565', 'icu-regextst:566', 'icu-regextst:567', - 'icu-regextst:580', - 'icu-regextst:581', - 'icu-regextst:582', - 'icu-regextst:583', - 'icu-regextst:584', - 'icu-regextst:585', 'icu-regextst:590', 'icu-regextst:591', 'icu-regextst:626', @@ -288,111 +147,32 @@ protected function get_known_failures(): array { 'icu-regextst:631', 'icu-regextst:632', 'icu-regextst:633', - 'icu-regextst:705', - 'icu-regextst:706', - 'icu-regextst:709', - 'icu-regextst:710', 'icu-regextst:711', 'icu-regextst:712', 'icu-regextst:713', 'icu-regextst:714', - 'icu-regextst:715', - 'icu-regextst:716', - 'icu-regextst:717', - 'icu-regextst:718', 'icu-regextst:719', 'icu-regextst:720', - 'icu-regextst:725', - 'icu-regextst:726', - 'icu-regextst:727', - 'icu-regextst:728', 'icu-regextst:843', 'icu-regextst:844', - 'icu-regextst:931', - 'icu-regextst:932', - 'icu-regextst:933', - 'icu-regextst:934', - 'icu-regextst:935', - 'icu-regextst:936', - 'icu-regextst:941', - 'icu-regextst:942', 'icu-regextst:949', 'icu-regextst:950', 'icu-regextst:951', 'icu-regextst:952', - 'icu-regextst:953', - 'icu-regextst:954', 'icu-regextst:963', 'icu-regextst:964', - 'icu-regextst:965', - 'icu-regextst:966', 'icu-regextst:967', 'icu-regextst:968', 'icu-regextst:969', 'icu-regextst:970', - 'icu-regextst:975', - 'icu-regextst:976', - 'icu-regextst:977', - 'icu-regextst:978', 'icu-regextst:979', 'icu-regextst:980', - 'icu-regextst:981', - 'icu-regextst:982', - 'icu-regextst:985', - 'icu-regextst:986', 'icu-regextst:993', 'icu-regextst:994', 'icu-regextst:995', 'icu-regextst:996', - 'icu-regextst:997', - 'icu-regextst:998', - 'icu-regextst:999', - 'icu-regextst:1000', - 'icu-regextst:1001', - 'icu-regextst:1002', - 'icu-regextst:1003', - 'icu-regextst:1004', - 'icu-regextst:1005', - 'icu-regextst:1006', - 'icu-regextst:1007', - 'icu-regextst:1008', - 'icu-regextst:1009', - 'icu-regextst:1010', - 'icu-regextst:1011', - 'icu-regextst:1012', - 'icu-regextst:1013', - 'icu-regextst:1014', - 'icu-regextst:1015', - 'icu-regextst:1016', - 'icu-regextst:1017', - 'icu-regextst:1018', 'icu-regextst:1019', - 'icu-regextst:1020', - 'icu-regextst:1021', - 'icu-regextst:1022', - 'icu-regextst:1023', - 'icu-regextst:1024', - 'icu-regextst:1025', - 'icu-regextst:1026', - 'icu-regextst:1027', - 'icu-regextst:1028', - 'icu-regextst:1031', - 'icu-regextst:1032', - 'icu-regextst:1034', - 'icu-regextst:1035', - 'icu-regextst:1036', - 'icu-regextst:1039', - 'icu-regextst:1040', - 'icu-regextst:1041', - 'icu-regextst:1042', - 'icu-regextst:1043', - 'icu-regextst:1044', - 'icu-regextst:1047', - 'icu-regextst:1048', - 'icu-regextst:1049', - 'icu-regextst:1050', - 'icu-regextst:1051', - 'icu-regextst:1052', + 'icu-regextst:1033', 'icu-regextst:1055', 'icu-regextst:1056', 'icu-regextst:1057', @@ -451,14 +231,6 @@ protected function get_known_failures(): array { 'icu-regextst:1130', 'icu-regextst:1131', 'icu-regextst:1132', - 'icu-regextst:1133', - 'icu-regextst:1134', - 'icu-regextst:1135', - 'icu-regextst:1136', - 'icu-regextst:1137', - 'icu-regextst:1138', - 'icu-regextst:1139', - 'icu-regextst:1140', 'icu-regextst:1141', 'icu-regextst:1142', 'icu-regextst:1179', @@ -467,8 +239,6 @@ protected function get_known_failures(): array { 'icu-regextst:1182', 'icu-regextst:1185', 'icu-regextst:1186', - 'icu-regextst:1199', - 'icu-regextst:1200', 'icu-regextst:1221', 'icu-regextst:1222', 'icu-regextst:1225', @@ -483,8 +253,6 @@ protected function get_known_failures(): array { 'icu-regextst:1242', 'icu-regextst:1243', 'icu-regextst:1244', - 'icu-regextst:1247', - 'icu-regextst:1248', 'icu-regextst:1249', 'icu-regextst:1250', 'icu-regextst:1251', @@ -499,16 +267,8 @@ protected function get_known_failures(): array { 'icu-regextst:1262', 'icu-regextst:1263', 'icu-regextst:1264', - 'icu-regextst:1267', - 'icu-regextst:1268', - 'icu-regextst:1269', - 'icu-regextst:1270', - 'icu-regextst:1271', - 'icu-regextst:1272', 'icu-regextst:1301', 'icu-regextst:1302', - 'icu-regextst:1318', - 'icu-regextst:1319', 'icu-regextst:1330', 'icu-regextst:1331', 'icu-regextst:1332', @@ -519,62 +279,10 @@ protected function get_known_failures(): array { 'icu-regextst:1337', 'icu-regextst:1338', 'icu-regextst:1339', - 'icu-regextst:1364', - 'icu-regextst:1365', - 'icu-regextst:1366', - 'icu-regextst:1367', - 'icu-regextst:1370', - 'icu-regextst:1371', - 'icu-regextst:1372', - 'icu-regextst:1373', - 'icu-regextst:1374', - 'icu-regextst:1375', - 'icu-regextst:1376', - 'icu-regextst:1377', - 'icu-regextst:1378', - 'icu-regextst:1379', - 'icu-regextst:1380', - 'icu-regextst:1381', - 'icu-regextst:1382', - 'icu-regextst:1383', - 'icu-regextst:1384', - 'icu-regextst:1385', - 'icu-regextst:1386', - 'icu-regextst:1387', - 'icu-regextst:1388', - 'icu-regextst:1389', - 'icu-regextst:1390', - 'icu-regextst:1391', 'icu-regextst:1392', 'icu-regextst:1393', 'icu-regextst:1394', 'icu-regextst:1395', - 'icu-regextst:1396', - 'icu-regextst:1397', - 'icu-regextst:1398', - 'icu-regextst:1399', - 'icu-regextst:1400', - 'icu-regextst:1401', - 'icu-regextst:1402', - 'icu-regextst:1403', - 'icu-regextst:1404', - 'icu-regextst:1405', - 'icu-regextst:1406', - 'icu-regextst:1407', - 'icu-regextst:1408', - 'icu-regextst:1409', - 'icu-regextst:1410', - 'icu-regextst:1411', - 'icu-regextst:1412', - 'icu-regextst:1413', - 'icu-regextst:1414', - 'icu-regextst:1415', - 'icu-regextst:1416', - 'icu-regextst:1417', - 'icu-regextst:1418', - 'icu-regextst:1419', - 'icu-regextst:1420', - 'icu-regextst:1421', 'icu-regextst:1422', 'icu-regextst:1423', 'icu-regextst:1424', @@ -611,215 +319,16 @@ protected function get_known_failures(): array { 'icu-regextst:1457', 'icu-regextst:1458', 'icu-regextst:1459', - 'icu-regextst:1466', - 'icu-regextst:1467', - 'icu-regextst:1468', - 'icu-regextst:1469', - 'icu-regextst:1470', - 'icu-regextst:1471', - 'icu-regextst:1472', - 'icu-regextst:1473', - 'icu-regextst:1474', - 'icu-regextst:1475', - 'icu-regextst:1476', - 'icu-regextst:1477', - 'icu-regextst:1478', - 'icu-regextst:1479', - 'icu-regextst:1480', - 'icu-regextst:1481', - 'icu-regextst:1482', - 'icu-regextst:1483', - 'icu-regextst:1484', - 'icu-regextst:1485', - 'icu-regextst:1490', - 'icu-regextst:1491', 'icu-regextst:1494', 'icu-regextst:1495', 'icu-regextst:1506', 'icu-regextst:1507', 'icu-regextst:1508', 'icu-regextst:1509', - 'icu-regextst:2768', - 'icu-regextst:2769', - 'icu-regextst:2770', - 'icu-regextst:2771', - 'icu-regextst:2772', - 'icu-regextst:2773', - 'icu-regextst:2774', - 'icu-regextst:2775', - 'icu-regextst:2776', - 'icu-regextst:2777', - 'icu-regextst:2778', - 'icu-regextst:2779', - 'icu-regextst:3338', - 'icu-regextst:3339', - 'icu-regextst:3340', - 'icu-regextst:3341', - 'icu-regextst:3342', - 'icu-regextst:3343', - 'icu-regextst:3344', - 'icu-regextst:3345', - 'icu-regextst:3396', - 'icu-regextst:3397', - 'icu-regextst:3398', - 'icu-regextst:3399', - 'icu-regextst:3400', - 'icu-regextst:3401', - 'icu-regextst:3402', - 'icu-regextst:3403', 'icu-regextst:3508', 'icu-regextst:3509', - 'icu-regextst:3518', - 'icu-regextst:3519', - 'icu-regextst:3520', - 'icu-regextst:3521', - 'icu-regextst:3522', - 'icu-regextst:3523', - 'icu-regextst:3524', - 'icu-regextst:3525', - 'icu-regextst:3538', - 'icu-regextst:3539', - 'icu-regextst:3540', - 'icu-regextst:3541', - 'icu-regextst:3542', - 'icu-regextst:3543', - 'icu-regextst:3544', - 'icu-regextst:3545', - 'icu-regextst:3606', - 'icu-regextst:3607', - 'icu-regextst:3608', - 'icu-regextst:3609', - 'icu-regextst:3610', - 'icu-regextst:3611', - 'icu-regextst:3836', - 'icu-regextst:3837', - 'icu-regextst:3838', - 'icu-regextst:3839', ); - // PCRE2 rejects a range with a class at one end, like "[\d-z]". PCRE 8 reads the "-" literally. - if ( $is_pcre2 ) { - array_push( - $failures, - 'mysql-server-suite:9539', - 'mysql-server-suite:9540', - 'mysql-server-suite:9541', - 'mysql-server-suite:9542', - 'mysql-server-suite:9543', - 'mysql-server-suite:9544', - 'mysql-server-suite:9545', - 'mysql-server-suite:9546', - 'mysql-server-suite:9547', - 'mysql-server-suite:9548', - 'mysql-server-suite:9549', - 'mysql-server-suite:9550', - 'mysql-server-suite:9551', - 'mysql-server-suite:9552', - 'mysql-server-suite:9553', - 'mysql-server-suite:9554', - 'mysql-server-suite:9555', - 'mysql-server-suite:9556', - 'mysql-server-suite:9557', - 'mysql-server-suite:9558', - 'mysql-server-suite:9559', - 'mysql-server-suite:9560', - 'mysql-server-suite:9561', - 'mysql-server-suite:9562', - 'mysql-server-suite:9563', - 'mysql-server-suite:9564', - 'mysql-server-suite:9565', - 'mysql-server-suite:9566', - 'mysql-server-suite:9567', - 'mysql-server-suite:9568', - 'mysql-server-suite:9569', - 'mysql-server-suite:9570', - 'mysql-server-suite:9571', - 'mysql-server-suite:9572', - 'mysql-server-suite:9573', - 'mysql-server-suite:9574', - 'mysql-server-suite:9575', - 'mysql-server-suite:9576', - 'mysql-server-suite:9577', - 'mysql-server-suite:9578', - 'mysql-server-suite:9579', - 'mysql-server-suite:9580', - 'mysql-server-suite:9581', - 'mysql-server-suite:9582', - 'mysql-server-suite:9583', - 'mysql-server-suite:9584', - 'mysql-server-suite:9585', - 'mysql-server-suite:9586', - 'mysql-server-suite:9587', - 'mysql-server-suite:9588', - 'mysql-server-suite:9589', - 'mysql-server-suite:9590', - 'mysql-server-suite:9617', - 'mysql-server-suite:9618', - 'mysql-server-suite:9619', - 'mysql-server-suite:9620', - 'mysql-server-suite:9621', - 'mysql-server-suite:9622', - 'mysql-server-suite:9623', - 'mysql-server-suite:9624', - 'mysql-server-suite:9625', - 'mysql-server-suite:9626', - 'mysql-server-suite:9627', - 'mysql-server-suite:9628', - 'mysql-server-suite:9629', - 'mysql-server-suite:9630', - 'mysql-server-suite:9631', - 'mysql-server-suite:9632', - 'mysql-server-suite:9633', - 'mysql-server-suite:9634', - 'mysql-server-suite:9635', - 'mysql-server-suite:9636', - 'mysql-server-suite:9637', - 'mysql-server-suite:9638', - 'mysql-server-suite:9639', - 'mysql-server-suite:9640', - 'mysql-server-suite:9641', - 'mysql-server-suite:9642', - 'mysql-server-suite:9645', - 'mysql-server-suite:9646', - 'mysql-server-suite:9663', - 'mysql-server-suite:9664', - 'icu-regextst:1037', - 'icu-regextst:1038', - 'icu-regextst:2460', - 'icu-regextst:2461', - 'icu-regextst:2462', - 'icu-regextst:2463', - 'icu-regextst:2464', - 'icu-regextst:2465', - 'icu-regextst:2466', - 'icu-regextst:2467', - 'icu-regextst:2468', - 'icu-regextst:2469', - 'icu-regextst:2470', - 'icu-regextst:2471', - 'icu-regextst:3892', - 'icu-regextst:3893', - 'icu-regextst:3894', - 'icu-regextst:3895', - 'icu-regextst:3896', - 'icu-regextst:3897', - 'icu-regextst:3898', - 'icu-regextst:3899', - 'icu-regextst:3900', - 'icu-regextst:3901', - 'icu-regextst:3902', - 'icu-regextst:3903' - ); - } - - // PCRE2 rejects a set difference after a class, like "[\w--b]". PCRE 8 reads the "-" literally, which gives MySQL's results here. - if ( $is_pcre2 ) { - array_push( - $failures, - 'icu-regextst:1033' - ); - } - // PCRE 8 rejects this nested lookbehind as not fixed in length. if ( ! $is_pcre2 ) { array_push( @@ -931,6 +440,28 @@ protected function get_known_failures(): array { 'mysql-server-suite:12452', 'mysql-server-suite:12453', 'mysql-server-suite:12454', + 'icu-regextst:1370', + 'icu-regextst:1371', + 'icu-regextst:1372', + 'icu-regextst:1373', + 'icu-regextst:1374', + 'icu-regextst:1375', + 'icu-regextst:1376', + 'icu-regextst:1377', + 'icu-regextst:1404', + 'icu-regextst:1405', + 'icu-regextst:1406', + 'icu-regextst:1407', + 'icu-regextst:1412', + 'icu-regextst:1413', + 'icu-regextst:1414', + 'icu-regextst:1415', + 'icu-regextst:1416', + 'icu-regextst:1417', + 'icu-regextst:1418', + 'icu-regextst:1419', + 'icu-regextst:1420', + 'icu-regextst:1421', 'icu-regextst:1452', 'icu-regextst:1453' ); @@ -962,44 +493,19 @@ protected function get_known_failures(): array { 'icu-regextst:1294', 'icu-regextst:1295', 'icu-regextst:1296', + 'icu-regextst:1470', + 'icu-regextst:1471', + 'icu-regextst:1472', + 'icu-regextst:1473', + 'icu-regextst:1478', + 'icu-regextst:1479', + 'icu-regextst:1480', + 'icu-regextst:1481', 'icu-regextst:1504', 'icu-regextst:1505' ); } - // Before PCRE2 10.43, \w didn't match combining marks, like the vowel signs of "नमस्ते", which ICU's \w does. - if ( version_compare( $pcre_version, '10.43', '<' ) ) { - array_push( - $failures, - 'mysql-server-suite:1533', - 'mysql-server-suite:1534', - 'mysql-server-suite:1553', - 'mysql-server-suite:1554', - 'mysql-server-suite:1557', - 'mysql-server-suite:1558', - 'mysql-server-suite:1701', - 'mysql-server-suite:1702', - 'mysql-server-suite:1721', - 'mysql-server-suite:1722', - 'mysql-server-suite:1725', - 'mysql-server-suite:1726', - 'mysql-server-suite:7919', - 'mysql-server-suite:7920' - ); - } - - // Since PCRE2 10.45, a caseless \p{Lu} matches any cased letter, like ICU. - if ( version_compare( $pcre_version, '10.45', '<' ) ) { - array_push( - $failures, - 'icu-regextst:41', - 'icu-regextst:43', - 'icu-regextst:189', - 'icu-regextst:1061', - 'icu-regextst:1063' - ); - } - return $failures; } }