mirror of
git://develop.git.wordpress.org/
synced 2025-02-07 16:10:43 +01:00
Tests: Correct MariaDB version check in database charset tests.
MariaDB version is reported differently between PHP versions: * PHP 8.0.16 or later: `10.6.8-MariaDB` * PHP 8.0.15 or earlier: `5.5.5-10.6.8-MariaDB` The latter includes PHP 7.4.x and PHP 5.6.x as well, where the version is also reported with the `5.5.5-` prefix. This commit makes an adjustment to the `Tests_DB_Charset` class to check for the correct version. References: * [https://github.com/php/php-src/issues/7972 php-src: #7972: MariaDB version prefix 5.5.5- is not stripped] * [https://github.com/php/php-src/pull/7963 php-src: PR #7963 Fix GH-7932: MariaDB version prefix not always stripped] Follow-up to [53918]. Fixes #53623. git-svn-id: https://develop.svn.wordpress.org/trunk@53919 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5d78ecbe25
commit
3e740230c3
@ -46,6 +46,15 @@ class Tests_DB_Charset extends WP_UnitTestCase {
|
||||
self::$db_version = self::$_wpdb->db_version();
|
||||
self::$db_server_info = self::$_wpdb->db_server_info();
|
||||
|
||||
// Account for MariaDB version being prefixed with '5.5.5-' on older PHP versions.
|
||||
if ( str_contains( self::$db_server_info, 'MariaDB' ) && '5.5.5' === self::$db_version
|
||||
&& PHP_VERSION_ID < 80016 // PHP 8.0.15 or older.
|
||||
) {
|
||||
// Strip the '5.5.5-' prefix and set the version to the correct value.
|
||||
self::$db_server_info = preg_replace( '/^5\.5\.5-(.*)/', '$1', self::$db_server_info );
|
||||
self::$db_version = preg_replace( '/[^0-9.].*/', '', self::$db_server_info );
|
||||
}
|
||||
|
||||
/*
|
||||
* MariaDB 10.6.1 or later and MySQL 8.0.30 or later
|
||||
* use utf8mb3 instead of utf8 in various commands output.
|
||||
|
Loading…
x
Reference in New Issue
Block a user