From 752429a58e080cdbcf7c35779b27bef975b3e494 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 22 Apr 2022 10:43:20 +0000 Subject: [PATCH] Code Modernization: Rename parameters that use reserved keywords in `wp_die_*_handler` filters. While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit renames the `$function` parameter to `$callback` in `wp_die_*_handler` filters, which aims to make it easier to use a non-reserved parameter name for anyone utilizing these filters. Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53243 git-svn-id: http://core.svn.wordpress.org/trunk@52832 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 26 +++++++++++++------------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1b8d788354..7fb2fcabe2 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3656,36 +3656,36 @@ function wp_die( $message = '', $title = '', $args = array() ) { * * @since 3.4.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); + $callback = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' ); } elseif ( wp_is_json_request() ) { /** * Filters the callback for killing WordPress execution for JSON requests. * * @since 5.1.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); + $callback = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) { /** * Filters the callback for killing WordPress execution for JSONP REST requests. * * @since 5.2.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' ); + $callback = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' ); } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { /** * Filters the callback for killing WordPress execution for XML-RPC requests. * * @since 3.4.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); + $callback = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); } elseif ( wp_is_xml_request() || isset( $wp_query ) && ( function_exists( 'is_feed' ) && is_feed() @@ -3696,21 +3696,21 @@ function wp_die( $message = '', $title = '', $args = array() ) { * * @since 5.2.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' ); + $callback = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' ); } else { /** * Filters the callback for killing WordPress execution for all non-Ajax, non-JSON, non-XML requests. * * @since 3.0.0 * - * @param callable $function Callback function name. + * @param callable $callback Callback function name. */ - $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); + $callback = apply_filters( 'wp_die_handler', '_default_wp_die_handler' ); } - call_user_func( $function, $message, $title, $args ); + call_user_func( $callback, $message, $title, $args ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index a9a838175b..101db5b121 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta2-53242'; +$wp_version = '6.0-beta2-53243'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.