Make WordPress Core

Changeset 52195

Timestamp:
11/17/2021 04:03:25 AM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r52176 r52195  
    12481248        } else {
    12491249            $class = get_class( $this );
    1250             if ( function_exists( '__' ) ) {
    1251                 /* translators: %s: Database access abstraction class, usually wpdb or a class extending wpdb. */
    1252                 _doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
    1253             } else {
    1254                 _doing_it_wrong( $class, sprintf( '%s must set a database connection for use with escaping.', $class ), '3.6.0' );
    1255             }
     1250
     1251            wp_load_translations_early();
     1252            /* translators: %s: Database access abstraction class, usually wpdb or a class extending wpdb. */
     1253            _doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
     1254
    12561255            $escaped = addslashes( $string );
    12571256        }
Note: See TracChangeset for help on using the changeset viewer.