mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-08 19:20:03 +00:00
WPDB: Call wp_load_translations_early() in wpdb::query() and wpdb::process_fields().
For consistency and simplification, replaces the `function_exists( '__' )` checks with `wp_load_translations_early()` to make sure i18n functions are available. This change removes the extra code introduced in [52176] for using non-translated error messages when `__()` is not available. Improves the plural versions of the error messages. For performance, when there are more than one problem field, uses `reset()` to populate the field in the error message. Follow-up to [52176], [52195]. Props sergeybiryukov, hellofromTonya. Fixes #32315. git-svn-id: https://develop.svn.wordpress.org/trunk@52218 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1189,10 +1189,16 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
* @param string $errored_fields Expected fields in the error message.
|
||||
*/
|
||||
private function get_db_error_value_too_long( $errored_fields ) {
|
||||
if ( str_contains( $errored_fields, ', ' ) ) {
|
||||
return sprintf(
|
||||
'WordPress database error: Processing the values for the following fields failed: %s. ' .
|
||||
'The supplied values may be too long or contain invalid data.',
|
||||
$errored_fields
|
||||
);
|
||||
}
|
||||
return sprintf(
|
||||
'WordPress database error: Processing the value for the following field%s failed: %s. ' .
|
||||
'WordPress database error: Processing the value for the following field failed: %s. ' .
|
||||
'The supplied value may be too long or contains invalid data.',
|
||||
str_contains( $errored_fields, ', ' ) ? 's' : '',
|
||||
$errored_fields
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user