Ticket #46813: 46813.6.diff
File 46813.6.diff, 2.5 KB (added by , 6 years ago) |
---|
-
src/wp-includes/functions.php
2944 2944 * @since 4.1.0 The `$title` and `$args` parameters were changed to optionally accept 2945 2945 * an integer to be used as the response code. 2946 2946 * @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added. 2947 * 2948 * @global WP_Query $wp_query 2947 2949 * 2948 2950 * @param string|WP_Error $message Optional. Error message. If this is a WP_Error object, 2949 2951 * and not an Ajax or XML-RPC request, the error's messages are used. … … 2969 2971 * is a WP_Error. 2970 2972 * @type bool $exit Whether to exit the process after completion. Default true. 2971 2973 * } 2974 * 2972 2975 */ 2973 2976 function wp_die( $message = '', $title = '', $args = array() ) { 2974 2977 2978 global $wp_query; 2979 2975 2980 if ( is_int( $args ) ) { 2976 2981 $args = array( 'response' => $args ); 2977 2982 } elseif ( is_int( $title ) ) { … … 3016 3021 */ 3017 3022 $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); 3018 3023 } elseif ( wp_is_xml_request() 3019 || function_exists( 'is_feed' ) && is_feed()3020 || function_exists( 'is_comment_feed' ) && is_comment_feed()3021 || function_exists( 'is_trackback' ) && is_trackback() ) {3024 || isset( $wp_query ) && function_exists( 'is_feed' ) && is_feed() 3025 || isset( $wp_query ) && function_exists( 'is_comment_feed' ) && is_comment_feed() 3026 || isset( $wp_query ) && function_exists( 'is_trackback' ) && is_trackback() ) { 3022 3027 /** 3023 3028 * Filters the callback for killing WordPress execution for XML requests. 3024 3029 * -
tests/phpunit/tests/includes/helpers.php
378 378 } 379 379 380 380 /** 381 * @ticket 46813 382 */ 383 public function test_wp_die_does_not_cause_doing_it_wrong_notice_without_wp_query_set() { 384 //Unset query to trigger _doing_it_wrong later 385 unset( $GLOBALS['wp_query'] ); 386 387 try { 388 //run wp_die to test if _doing_it_wrong runs 389 wp_die(); 390 } catch ( WPDieException $e ) { 391 //do nothing with exception regardless 392 } 393 394 $this->assertEmpty( $this->caught_doing_it_wrong ); 395 } 396 397 /** 381 398 * This test is just a setup for the one that follows. 382 399 * 383 400 * @ticket 38196