From 5e48f0c59187719b9b51ddd9d8d5f7637d2729af Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 17 Nov 2021 04:05:02 +0000 Subject: [PATCH] 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 --- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index e49aadf12b..c414c91cfe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 57c3bd76f6..0f54405185 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -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 ); }