Ticket #46813: 46813.7.diff
File 46813.7.diff, 2.3 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. … … 2972 2974 */ 2973 2975 function wp_die( $message = '', $title = '', $args = array() ) { 2974 2976 2977 global $wp_query; 2978 2975 2979 if ( is_int( $args ) ) { 2976 2980 $args = array( 'response' => $args ); 2977 2981 } elseif ( is_int( $title ) ) { … … 3016 3020 */ 3017 3021 $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); 3018 3022 } 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() ) {3023 || isset( $wp_query ) && function_exists( 'is_feed' ) && is_feed() 3024 || isset( $wp_query ) && function_exists( 'is_comment_feed' ) && is_comment_feed() 3025 || isset( $wp_query ) && function_exists( 'is_trackback' ) && is_trackback() ) { 3022 3026 /** 3023 3027 * Filters the callback for killing WordPress execution for XML requests. 3024 3028 * -
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