From 2fed7bf5818813f43a61353435f38791ad0ab2d8 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 1 Jun 2020 20:48:27 +0000 Subject: [PATCH] Build/Test Tools: Avoid an empty "title" heading if no title is set in `_wp_die_handler_exit()` and `_wp_die_handler_txt()`. Fixes #50297. git-svn-id: https://develop.svn.wordpress.org/trunk@47882 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/functions.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/includes/functions.php b/tests/phpunit/includes/functions.php index dd80e887ce..4b88b59da3 100644 --- a/tests/phpunit/includes/functions.php +++ b/tests/phpunit/includes/functions.php @@ -205,8 +205,12 @@ function _wp_die_handler_filter_exit() { */ function _wp_die_handler_txt( $message, $title, $args ) { echo "\nwp_die called\n"; - echo "Message : $message\n"; - echo "Title : $title\n"; + echo "Message: $message\n"; + + if ( ! empty( $title ) ) { + echo "Title: $title\n"; + } + if ( ! empty( $args ) ) { echo "Args: \n"; foreach ( $args as $k => $v ) { @@ -224,8 +228,12 @@ function _wp_die_handler_txt( $message, $title, $args ) { */ function _wp_die_handler_exit( $message, $title, $args ) { echo "\nwp_die called\n"; - echo "Message : $message\n"; - echo "Title : $title\n"; + echo "Message: $message\n"; + + if ( ! empty( $title ) ) { + echo "Title: $title\n"; + } + if ( ! empty( $args ) ) { echo "Args: \n"; foreach ( $args as $k => $v ) {