Changeset 52218
- Timestamp:
- 11/19/2021 06:58:14 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r52206 r52218 2018 2018 $this->last_query = $query; 2019 2019 2020 if ( function_exists( '__' ) ) { 2021 $this->last_error = __( 'WordPress database error: Could not perform query because it contains invalid data.' ); 2022 } else { 2023 $this->last_error = 'WordPress database error: Could not perform query because it contains invalid data.'; 2024 } 2020 wp_load_translations_early(); 2021 2022 $this->last_error = __( 'WordPress database error: Could not perform query because it contains invalid data.' ); 2025 2023 2026 2024 return false; … … 2551 2549 } 2552 2550 2551 wp_load_translations_early(); 2552 2553 2553 if ( 1 === count( $problem_fields ) ) { 2554 if ( function_exists( '__' ) ) { 2555 /* translators: %s Database field where the error occurred. */ 2556 $message = __( 'WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.' ); 2557 } else { 2558 $message = 'WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.'; 2559 } 2554 $this->last_error = sprintf( 2555 /* translators: %s: Database field where the error occurred. */ 2556 __( 'WordPress database error: Processing the value for the following field failed: %s. The supplied value may be too long or contains invalid data.' ), 2557 reset( $problem_fields ) 2558 ); 2560 2559 } else { 2561 if ( function_exists( '__' ) ) { 2562 /* translators: %s Database fields where the error occurred. */ 2563 $message = __( 'WordPress database error: Processing the value for the following fields failed: %s. The supplied value may be too long or contains invalid data.' ); 2564 } else { 2565 $message = 'WordPress database error: Processing the value for the following fields failed: %s. The supplied value may be too long or contains invalid data.'; 2566 } 2567 } 2568 2569 $this->last_error = sprintf( $message, implode( ', ', $problem_fields ) ); 2560 $this->last_error = sprintf( 2561 /* translators: %s: Database fields where the error occurred. */ 2562 __( 'WordPress database error: Processing the values for the following fields failed: %s. The supplied values may be too long or contain invalid data.' ), 2563 implode( ', ', $problem_fields ) 2564 ); 2565 } 2570 2566 2571 2567 return false; -
trunk/tests/phpunit/tests/db.php
r52176 r52218 1190 1190 */ 1191 1191 private function get_db_error_value_too_long( $errored_fields ) { 1192 if ( str_contains( $errored_fields, ', ' ) ) { 1193 return sprintf( 1194 'WordPress database error: Processing the values for the following fields failed: %s. ' . 1195 'The supplied values may be too long or contain invalid data.', 1196 $errored_fields 1197 ); 1198 } 1192 1199 return sprintf( 1193 'WordPress database error: Processing the value for the following field %sfailed: %s. ' .1200 'WordPress database error: Processing the value for the following field failed: %s. ' . 1194 1201 'The supplied value may be too long or contains invalid data.', 1195 str_contains( $errored_fields, ', ' ) ? 's' : '',1196 1202 $errored_fields 1197 1203 );
Note: See TracChangeset
for help on using the changeset viewer.