Changeset 57926 for trunk/src/wp-includes/class-wpdb.php
- Timestamp:
- 04/04/2024 03:11:37 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wpdb.php
r57239 r57926 879 879 } 880 880 881 if ( 'utf8' === $charset && $this->has_cap( 'utf8mb4' )) {881 if ( 'utf8' === $charset ) { 882 882 $charset = 'utf8mb4'; 883 }884 885 if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) {886 $charset = 'utf8';887 $collate = str_replace( 'utf8mb4_', 'utf8_', $collate );888 883 } 889 884 … … 3243 3238 list( $charset ) = explode( '_', $column->Collation ); 3244 3239 3245 // If the current connection can't support utf8mb4 characters, let's only send 3-byte utf8 characters.3246 if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) {3247 $charset = 'utf8';3248 }3249 3250 3240 $charsets[ strtolower( $charset ) ] = true; 3251 3241 } … … 4058 4048 * @since 4.6.0 Added support for the 'utf8mb4_520' feature. 4059 4049 * @since 6.2.0 Added support for the 'identifier_placeholders' feature. 4050 * @since 6.6.0 The `utf8mb4` feature now always returns true. 4060 4051 * 4061 4052 * @see wpdb::db_version() … … 4093 4084 return version_compare( $db_version, '5.0.7', '>=' ); 4094 4085 case 'utf8mb4': // @since 4.1.0 4095 if ( version_compare( $db_version, '5.5.3', '<' ) ) { 4096 return false; 4097 } 4098 4099 $client_version = mysqli_get_client_info(); 4100 4101 /* 4102 * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server. 4103 * mysqlnd has supported utf8mb4 since 5.0.9. 4104 * 4105 * Note: str_contains() is not used here, as this file can be included 4106 * directly outside of WordPress core, e.g. by HyperDB, in which case 4107 * the polyfills from wp-includes/compat.php are not loaded. 4108 */ 4109 if ( false !== strpos( $client_version, 'mysqlnd' ) ) { 4110 $client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version ); 4111 return version_compare( $client_version, '5.0.9', '>=' ); 4112 } else { 4113 return version_compare( $client_version, '5.5.3', '>=' ); 4114 } 4086 return true; 4115 4087 case 'utf8mb4_520': // @since 4.6.0 4116 4088 return version_compare( $db_version, '5.6', '>=' );
Note: See TracChangeset
for help on using the changeset viewer.