WPDB: Call `wp_load_translations_early()` in `wpdb::_real_escape()`.

This follows the pattern used in other `wpdb` methods to make sure the i18n functions are available.

Follow-up to [29840].

Props nacin, johnbillion.
See #32315.
Built from https://develop.svn.wordpress.org/trunk@52195


git-svn-id: http://core.svn.wordpress.org/trunk@51787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-11-17 04:05:02 +00:00
parent ab78f7561a
commit 5e48f0c591
2 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52194';
$wp_version = '5.9-alpha-52195';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1247,12 +1247,11 @@ class wpdb {
}
} else {
$class = get_class( $this );
if ( function_exists( '__' ) ) {
/* translators: %s: Database access abstraction class, usually wpdb or a class extending wpdb. */
_doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
} else {
_doing_it_wrong( $class, sprintf( '%s must set a database connection for use with escaping.', $class ), '3.6.0' );
}
wp_load_translations_early();
/* translators: %s: Database access abstraction class, usually wpdb or a class extending wpdb. */
_doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
$escaped = addslashes( $string );
}