Skip to content

Commit 06d8d3d

Browse files
Tests: Replace deprecated mb_split() with preg_split() in date query tests.
Oniguruma, which is the regex engine behind the `mbstring` extension, ended maintenance in April 2025. Since the PHP project can no longer expect upstream security fixes on it, all `mbstring` regex functionality is deprecated in PHP 8.6, including the `mb_ereg*()` family and `mb_split()`, with removal in PHP 9.0. A PECL package, `mb_onig`, has been created for those who rely on this functionality, but the recommendation is to use PCRE functions with the `/u` modifier instead. This commit replaces the only three instances of `mb_split()` in WordPress core test suite with `preg_split()`. References: * [https://wiki.php.net/rfc/eol-oniguruma PHP RFC: Oniguruma maintenance end and end of mbregex] * [https://www.zend.com/blog/php-8-6#what-deprecations-come-with-php-8-6 Zend: What's New in PHP 8.6: Features, Changes, and Deprecations] Follow-up to r54530. Props arshidkv12, SergeyBiryukov. Fixes #66137. git-svn-id: https://develop.svn.wordpress.org/trunk@63768 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 86b922f commit 06d8d3d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎tests/phpunit/tests/date/query.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ public function test_relation_in_query_and() {
11841184

11851185
$sql = $q->get_sql();
11861186

1187-
$parts = mb_split( '\)\s+AND\s+\(', $sql );
1187+
$parts = preg_split( '#\)\s+AND\s+\(#', $sql );
11881188
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
11891189
$this->assertCount( 2, $parts, 'SQL query does not contain correct number of AND operators.' );
11901190

@@ -1231,7 +1231,7 @@ public function test_relation_in_query_or() {
12311231

12321232
$this->assertStringContainsString( 'OR', $sql, 'SQL query does not contain conditions joined by operator OR.' );
12331233

1234-
$parts = mb_split( '\)\s+OR\s+\(', $sql );
1234+
$parts = preg_split( '#\)\s+OR\s+\(#', $sql );
12351235
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator OR.' );
12361236
$this->assertCount( 2, $parts, 'SQL query does not contain correct number of OR operators.' );
12371237

@@ -1277,7 +1277,7 @@ public function test_relation_in_query_unsupported() {
12771277

12781278
$sql = $q->get_sql();
12791279

1280-
$parts = mb_split( '\)\s+AND\s+\(', $sql );
1280+
$parts = preg_split( '#\)\s+AND\s+\(#', $sql );
12811281
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
12821282
$this->assertCount( 2, $parts, 'SQL query does not contain correct number of AND operators.' );
12831283

0 commit comments

Comments
 (0)