Changeset 54384
- Timestamp:
- 10/04/2022 03:39:28 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wpdb.php
r54240 r54384 3961 3961 */ 3962 3962 public function has_cap( $db_cap ) { 3963 $version = $this->db_version(); 3963 $db_version = $this->db_version(); 3964 $db_server_info = $this->db_server_info(); 3965 3966 // Account for MariaDB version being prefixed with '5.5.5-' on older PHP versions. 3967 if ( '5.5.5' === $db_version && str_contains( $db_server_info, 'MariaDB' ) 3968 && PHP_VERSION_ID < 80016 // PHP 8.0.15 or older. 3969 ) { 3970 // Strip the '5.5.5-' prefix and set the version to the correct value. 3971 $db_server_info = preg_replace( '/^5\.5\.5-(.*)/', '$1', $db_server_info ); 3972 $db_version = preg_replace( '/[^0-9.].*/', '', $db_server_info ); 3973 } 3964 3974 3965 3975 switch ( strtolower( $db_cap ) ) { … … 3967 3977 case 'group_concat': // @since 2.7.0 3968 3978 case 'subqueries': // @since 2.7.0 3969 return version_compare( $ version, '4.1', '>=' );3979 return version_compare( $db_version, '4.1', '>=' ); 3970 3980 case 'set_charset': 3971 return version_compare( $ version, '5.0.7', '>=' );3981 return version_compare( $db_version, '5.0.7', '>=' ); 3972 3982 case 'utf8mb4': // @since 4.1.0 3973 if ( version_compare( $ version, '5.5.3', '<' ) ) {3983 if ( version_compare( $db_version, '5.5.3', '<' ) ) { 3974 3984 return false; 3975 3985 } … … 3991 4001 } 3992 4002 case 'utf8mb4_520': // @since 4.6.0 3993 return version_compare( $ version, '5.6', '>=' );4003 return version_compare( $db_version, '5.6', '>=' ); 3994 4004 case 'identifier_placeholders': // @since 6.1.0 3995 4005 /* -
trunk/tests/phpunit/tests/db/charset.php
r53919 r54384 48 48 49 49 // Account for MariaDB version being prefixed with '5.5.5-' on older PHP versions. 50 if ( str_contains( self::$db_server_info, 'MariaDB' ) && '5.5.5' === self::$db_version50 if ( '5.5.5' === self::$db_version && str_contains( self::$db_server_info, 'MariaDB' ) 51 51 && PHP_VERSION_ID < 80016 // PHP 8.0.15 or older. 52 52 ) { … … 1190 1190 self::$_wpdb->set_charset( self::$_wpdb->dbh ); 1191 1191 } 1192 1193 /** 1194 * @ticket 54841 1195 */ 1196 public function test_mariadb_supports_utf8mb4_520() { 1197 global $wpdb; 1198 1199 // utf8mb4_520 is available in MariaDB since version 10.2. 1200 if ( ! str_contains( self::$db_server_info, 'MariaDB' ) 1201 || version_compare( self::$db_version, '10.2', '<' ) 1202 ) { 1203 $this->markTestSkipped( 'This test requires MariaDB 10.2 or later.' ); 1204 } 1205 1206 $this->assertTrue( $wpdb->has_cap( 'utf8mb4_520' ) ); 1207 } 1192 1208 }
Note: See TracChangeset
for help on using the changeset viewer.