update remaining print_r in HPOS code

This commit is contained in:
Ron Rennick 2023-06-20 14:01:02 -03:00
parent ada3031725
commit f012b4d038
3 changed files with 4 additions and 7 deletions

View File

@ -494,8 +494,7 @@ class CLIRunner {
)
);
} else {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- This is a CLI command and debugging code is intended.
$errors = print_r( $failed_ids, true );
$errors = wp_json_encode( $failed_ids, JSON_PRETTY_PRINT );
return WP_CLI::error(
sprintf(

View File

@ -368,13 +368,12 @@ class BatchProcessingController {
$batch_detail_string = '';
// Log only first and last, as the entire batch may be too big.
if ( count( $batch ) > 0 ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- Logging is for debugging.
$batch_detail_string = '\n' . print_r(
$batch_detail_string = "\n" . wp_json_encode(
array(
'batch_start' => $batch[0],
'batch_end' => end( $batch ),
),
true
JSON_PRETTY_PRINT
);
}
$error_message = "Error processing batch for {$batch_processor->get_name()}: {$error->getMessage()}" . $batch_detail_string;

View File

@ -1308,8 +1308,7 @@ WHERE
* @return void
*/
private function log_diff( array $diff ): void {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- This is a log function.
$this->error_logger->notice( 'Diff found: ' . print_r( $diff, true ) );
$this->error_logger->notice( 'Diff found: ' . wp_json_encode( $diff, JSON_PRETTY_PRINT ) );
}
/**