Code Modernization: Rename parameters that use reserved keywords in `wp-includes/functions.php`.

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 `$echo` parameter to `$display` in:
 * `wp_nonce_field()`
 * `wp_referer_field()`
 * `wp_original_referer_field()`
* Renames the `$string` parameter to `$input_string` in
 * `_wp_json_convert_string()`
 * `_wp_to_kebab_case()`
* Renames the `$list` parameter to `$input_list` in:
 * `wp_parse_list()`
 * `wp_parse_id_list()`
 * `wp_parse_slug_list()`
 * `wp_filter_object_list()`
 * `wp_list_filter()`
 * `wp_list_pluck()`
 * `wp_list_sort()`
* Renames the `$array` parameter to `$input_array` in:
 * `add_magic_quotes()`
 * `wp_array_slice_assoc()`
 * `_wp_array_get()`
 * `_wp_array_set()`
* Renames the `$function` parameter to `$function_name` in:
 * `_deprecated_function()`
 * `_deprecated_argument()`
 * `_doing_it_wrong()`
* Renames the `$class` parameter to `$class_name` in `_deprecated_constructor()`.
* Renames the `$default` parameter to `$default_value` in `apache_mod_loaded()`.
* Renames the `$var` parameter to `$value` in `wp_validate_boolean()`.
* Amends the `$input` parameter in `wp_parse_str()` for consistency.

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], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@54929


git-svn-id: http://core.svn.wordpress.org/trunk@54481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-12-03 15:07:14 +00:00
parent ef3a00a869
commit a460de4e58
3 changed files with 168 additions and 168 deletions

View File

@ -5033,11 +5033,11 @@ function map_deep( $value, $callback ) {
*
* @since 2.2.1
*
* @param string $input The string to be parsed.
* @param string $input_string The string to be parsed.
* @param array $result Variables will be stored in this array.
*/
function wp_parse_str( $input, &$result ) {
parse_str( (string) $input, $result );
function wp_parse_str( $input_string, &$result ) {
parse_str( (string) $input_string, $result );
/**
* Filters the array of variables derived from a parsed string.

View File

@ -1267,21 +1267,21 @@ function wp_removable_query_args() {
* @since 0.71
* @since 5.5.0 Non-string values are left untouched.
*
* @param array $array Array to walk while sanitizing contents.
* @return array Sanitized $array.
* @param array $input_array Array to walk while sanitizing contents.
* @return array Sanitized $input_array.
*/
function add_magic_quotes( $array ) {
foreach ( (array) $array as $k => $v ) {
function add_magic_quotes( $input_array ) {
foreach ( (array) $input_array as $k => $v ) {
if ( is_array( $v ) ) {
$array[ $k ] = add_magic_quotes( $v );
$input_array[ $k ] = add_magic_quotes( $v );
} elseif ( is_string( $v ) ) {
$array[ $k ] = addslashes( $v );
$input_array[ $k ] = addslashes( $v );
} else {
continue;
}
}
return $array;
return $input_array;
}
/**
@ -1867,10 +1867,10 @@ function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
* @param int|string $action Optional. Action name. Default -1.
* @param string $name Optional. Nonce name. Default '_wpnonce'.
* @param bool $referer Optional. Whether to set the referer field for validation. Default true.
* @param bool $echo Optional. Whether to display or return hidden form field. Default true.
* @param bool $display Optional. Whether to display or return hidden form field. Default true.
* @return string Nonce field HTML markup.
*/
function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) {
function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $display = true ) {
$name = esc_attr( $name );
$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
@ -1878,7 +1878,7 @@ function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $ech
$nonce_field .= wp_referer_field( false );
}
if ( $echo ) {
if ( $display ) {
echo $nonce_field;
}
@ -1893,14 +1893,14 @@ function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $ech
*
* @since 2.0.4
*
* @param bool $echo Optional. Whether to echo or return the referer field. Default true.
* @param bool $display Optional. Whether to echo or return the referer field. Default true.
* @return string Referer field HTML markup.
*/
function wp_referer_field( $echo = true ) {
function wp_referer_field( $display = true ) {
$request_url = remove_query_arg( '_wp_http_referer' );
$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';
if ( $echo ) {
if ( $display ) {
echo $referer_field;
}
@ -1916,12 +1916,12 @@ function wp_referer_field( $echo = true ) {
*
* @since 2.0.4
*
* @param bool $echo Optional. Whether to echo the original http referer. Default true.
* @param bool $display Optional. Whether to echo the original http referer. Default true.
* @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
* Default 'current'.
* @return string Original referer field.
*/
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
function wp_original_referer_field( $display = true, $jump_back_to = 'current' ) {
$ref = wp_get_original_referer();
if ( ! $ref ) {
@ -1930,7 +1930,7 @@ function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
if ( $echo ) {
if ( $display ) {
echo $orig_referer_field;
}
@ -4336,24 +4336,24 @@ function _wp_json_sanity_check( $data, $depth ) {
*
* @see _wp_json_sanity_check()
*
* @param string $string The string which is to be converted.
* @param string $input_string The string which is to be converted.
* @return string The checked string.
*/
function _wp_json_convert_string( $string ) {
function _wp_json_convert_string( $input_string ) {
static $use_mb = null;
if ( is_null( $use_mb ) ) {
$use_mb = function_exists( 'mb_convert_encoding' );
}
if ( $use_mb ) {
$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
$encoding = mb_detect_encoding( $input_string, mb_detect_order(), true );
if ( $encoding ) {
return mb_convert_encoding( $string, 'UTF-8', $encoding );
return mb_convert_encoding( $input_string, 'UTF-8', $encoding );
} else {
return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
return mb_convert_encoding( $input_string, 'UTF-8', 'UTF-8' );
}
} else {
return wp_check_invalid_utf8( $string, true );
return wp_check_invalid_utf8( $input_string, true );
}
}
@ -4811,18 +4811,18 @@ function wp_parse_args( $args, $defaults = array() ) {
*
* @since 5.1.0
*
* @param array|string $list List of values.
* @param array|string $input_list List of values.
* @return array Array of values.
*/
function wp_parse_list( $list ) {
if ( ! is_array( $list ) ) {
return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
function wp_parse_list( $input_list ) {
if ( ! is_array( $input_list ) ) {
return preg_split( '/[\s,]+/', $input_list, -1, PREG_SPLIT_NO_EMPTY );
}
// Validate all entries of the list are scalar.
$list = array_filter( $list, 'is_scalar' );
$input_list = array_filter( $input_list, 'is_scalar' );
return $list;
return $input_list;
}
/**
@ -4831,13 +4831,13 @@ function wp_parse_list( $list ) {
* @since 3.0.0
* @since 5.1.0 Refactored to use wp_parse_list().
*
* @param array|string $list List of IDs.
* @param array|string $input_list List of IDs.
* @return int[] Sanitized array of IDs.
*/
function wp_parse_id_list( $list ) {
$list = wp_parse_list( $list );
function wp_parse_id_list( $input_list ) {
$input_list = wp_parse_list( $input_list );
return array_unique( array_map( 'absint', $list ) );
return array_unique( array_map( 'absint', $input_list ) );
}
/**
@ -4846,13 +4846,13 @@ function wp_parse_id_list( $list ) {
* @since 4.7.0
* @since 5.1.0 Refactored to use wp_parse_list().
*
* @param array|string $list List of slugs.
* @param array|string $input_list List of slugs.
* @return string[] Sanitized array of slugs.
*/
function wp_parse_slug_list( $list ) {
$list = wp_parse_list( $list );
function wp_parse_slug_list( $input_list ) {
$input_list = wp_parse_list( $input_list );
return array_unique( array_map( 'sanitize_title', $list ) );
return array_unique( array_map( 'sanitize_title', $input_list ) );
}
/**
@ -4860,16 +4860,16 @@ function wp_parse_slug_list( $list ) {
*
* @since 3.1.0
*
* @param array $array The original array.
* @param array $input_array The original array.
* @param array $keys The list of keys.
* @return array The array slice.
*/
function wp_array_slice_assoc( $array, $keys ) {
function wp_array_slice_assoc( $input_array, $keys ) {
$slice = array();
foreach ( $keys as $key ) {
if ( isset( $array[ $key ] ) ) {
$slice[ $key ] = $array[ $key ];
if ( isset( $input_array[ $key ] ) ) {
$slice[ $key ] = $input_array[ $key ];
}
}
@ -4884,44 +4884,44 @@ function wp_array_slice_assoc( $array, $keys ) {
*
* Example usage:
*
* $array = array(
* $input_array = array(
* 'a' => array(
* 'b' => array(
* 'c' => 1,
* ),
* ),
* );
* _wp_array_get( $array, array( 'a', 'b', 'c' ) );
* _wp_array_get( $input_array, array( 'a', 'b', 'c' ) );
*
* @internal
*
* @since 5.6.0
* @access private
*
* @param array $array An array from which we want to retrieve some information.
* @param array $input_array An array from which we want to retrieve some information.
* @param array $path An array of keys describing the path with which to retrieve information.
* @param mixed $default Optional. The return value if the path does not exist within the array,
* or if `$array` or `$path` are not arrays. Default null.
* @param mixed $default_value Optional. The return value if the path does not exist within the array,
* or if `$input_array` or `$path` are not arrays. Default null.
* @return mixed The value from the path specified.
*/
function _wp_array_get( $array, $path, $default = null ) {
function _wp_array_get( $input_array, $path, $default_value = null ) {
// Confirm $path is valid.
if ( ! is_array( $path ) || 0 === count( $path ) ) {
return $default;
return $default_value;
}
foreach ( $path as $path_element ) {
if (
! is_array( $array ) ||
! is_array( $input_array ) ||
( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) ||
! array_key_exists( $path_element, $array )
! array_key_exists( $path_element, $input_array )
) {
return $default;
return $default_value;
}
$array = $array[ $path_element ];
$input_array = $input_array[ $path_element ];
}
return $array;
return $input_array;
}
/**
@ -4932,10 +4932,10 @@ function _wp_array_get( $array, $path, $default = null ) {
*
* Example usage:
*
* $array = array();
* _wp_array_set( $array, array( 'a', 'b', 'c', 1 ) );
* $input_array = array();
* _wp_array_set( $input_array, array( 'a', 'b', 'c', 1 ) );
*
* $array becomes:
* $input_array becomes:
* array(
* 'a' => array(
* 'b' => array(
@ -4949,13 +4949,13 @@ function _wp_array_get( $array, $path, $default = null ) {
* @since 5.8.0
* @access private
*
* @param array $array An array that we want to mutate to include a specific value in a path.
* @param array $input_array An array that we want to mutate to include a specific value in a path.
* @param array $path An array of keys describing the path that we want to mutate.
* @param mixed $value The value that will be set.
*/
function _wp_array_set( &$array, $path, $value = null ) {
// Confirm $array is valid.
if ( ! is_array( $array ) ) {
function _wp_array_set( &$input_array, $path, $value = null ) {
// Confirm $input_array is valid.
if ( ! is_array( $input_array ) ) {
return;
}
@ -4982,15 +4982,15 @@ function _wp_array_set( &$array, $path, $value = null ) {
for ( $i = 0; $i < $path_length - 1; ++$i ) {
$path_element = $path[ $i ];
if (
! array_key_exists( $path_element, $array ) ||
! is_array( $array[ $path_element ] )
! array_key_exists( $path_element, $input_array ) ||
! is_array( $input_array[ $path_element ] )
) {
$array[ $path_element ] = array();
$input_array[ $path_element ] = array();
}
$array = &$array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
$input_array = &$input_array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
}
$array[ $path[ $i ] ] = $value;
$input_array[ $path[ $i ] ] = $value;
}
/**
@ -5014,11 +5014,11 @@ function _wp_array_set( &$array, $path, $value = null ) {
* @link https://github.com/lodash-php/lodash-php/blob/master/src/String/kebabCase.php
* @link https://github.com/lodash-php/lodash-php/blob/master/src/internal/unicodeWords.php
*
* @param string $string The string to kebab-case.
* @param string $input_string The string to kebab-case.
*
* @return string kebab-cased-string.
*/
function _wp_to_kebab_case( $string ) {
function _wp_to_kebab_case( $input_string ) {
//phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
// ignore the camelCase names for variables so the names are the same as lodash
// so comparing and porting new changes is easier.
@ -5065,7 +5065,7 @@ function _wp_to_kebab_case( $string ) {
)
) . '/u';
preg_match_all( $regexp, str_replace( "'", '', $string ), $matches );
preg_match_all( $regexp, str_replace( "'", '', $input_string ), $matches );
return strtolower( implode( '-', $matches[0] ) );
//phpcs:enable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
}
@ -5106,7 +5106,7 @@ function wp_is_numeric_array( $data ) {
* @since 3.0.0
* @since 4.7.0 Uses `WP_List_Util` class.
*
* @param array $list An array of objects to filter.
* @param array $input_list An array of objects to filter.
* @param array $args Optional. An array of key => value arguments to match
* against each object. Default empty array.
* @param string $operator Optional. The logical operation to perform. 'AND' means
@ -5117,12 +5117,12 @@ function wp_is_numeric_array( $data ) {
* of the entire object. Default false.
* @return array A list of objects or object fields.
*/
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
if ( ! is_array( $list ) ) {
function wp_filter_object_list( $input_list, $args = array(), $operator = 'and', $field = false ) {
if ( ! is_array( $input_list ) ) {
return array();
}
$util = new WP_List_Util( $list );
$util = new WP_List_Util( $input_list );
$util->filter( $args, $operator );
@ -5150,7 +5150,7 @@ function wp_filter_object_list( $list, $args = array(), $operator = 'and', $fiel
* @since 4.7.0 Uses `WP_List_Util` class.
* @since 5.9.0 Converted into a wrapper for `wp_filter_object_list()`.
*
* @param array $list An array of objects to filter.
* @param array $input_list An array of objects to filter.
* @param array $args Optional. An array of key => value arguments to match
* against each object. Default empty array.
* @param string $operator Optional. The logical operation to perform. 'AND' means
@ -5159,8 +5159,8 @@ function wp_filter_object_list( $list, $args = array(), $operator = 'and', $fiel
* match. Default 'AND'.
* @return array Array of found values.
*/
function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
return wp_filter_object_list( $list, $args, $operator );
function wp_list_filter( $input_list, $args = array(), $operator = 'AND' ) {
return wp_filter_object_list( $input_list, $args, $operator );
}
/**
@ -5173,20 +5173,20 @@ function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
* @since 4.0.0 $index_key parameter added.
* @since 4.7.0 Uses `WP_List_Util` class.
*
* @param array $list List of objects or arrays.
* @param array $input_list List of objects or arrays.
* @param int|string $field Field from the object to place instead of the entire object.
* @param int|string $index_key Optional. Field from the object to use as keys for the new array.
* Default null.
* @return array Array of found values. If `$index_key` is set, an array of found values with keys
* corresponding to `$index_key`. If `$index_key` is null, array keys from the original
* `$list` will be preserved in the results.
* `$input_list` will be preserved in the results.
*/
function wp_list_pluck( $list, $field, $index_key = null ) {
if ( ! is_array( $list ) ) {
function wp_list_pluck( $input_list, $field, $index_key = null ) {
if ( ! is_array( $input_list ) ) {
return array();
}
$util = new WP_List_Util( $list );
$util = new WP_List_Util( $input_list );
return $util->pluck( $field, $index_key );
}
@ -5196,7 +5196,7 @@ function wp_list_pluck( $list, $field, $index_key = null ) {
*
* @since 4.7.0
*
* @param array $list An array of objects or arrays to sort.
* @param array $input_list An array of objects or arrays to sort.
* @param string|array $orderby Optional. Either the field name to order by or an array
* of multiple orderby fields as `$orderby => $order`.
* Default empty array.
@ -5205,12 +5205,12 @@ function wp_list_pluck( $list, $field, $index_key = null ) {
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
* @return array The sorted array.
*/
function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
if ( ! is_array( $list ) ) {
function wp_list_sort( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
if ( ! is_array( $input_list ) ) {
return array();
}
$util = new WP_List_Util( $list );
$util = new WP_List_Util( $input_list );
return $util->sort( $orderby, $order, $preserve_keys );
}
@ -5348,22 +5348,22 @@ function absint( $maybeint ) {
* @since 5.4.0 This function is no longer marked as "private".
* @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $version The version of WordPress that deprecated the function.
* @param string $replacement Optional. The function that should have been called. Default empty.
*/
function _deprecated_function( $function, $version, $replacement = '' ) {
function _deprecated_function( $function_name, $version, $replacement = '' ) {
/**
* Fires when a deprecated function is called.
*
* @since 2.5.0
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $replacement The function that should have been called.
* @param string $version The version of WordPress that deprecated the function.
*/
do_action( 'deprecated_function_run', $function, $replacement, $version );
do_action( 'deprecated_function_run', $function_name, $replacement, $version );
/**
* Filters whether to trigger an error for deprecated functions.
@ -5379,7 +5379,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
sprintf(
/* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
__( 'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$function,
$function_name,
$version,
$replacement
),
@ -5390,7 +5390,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
sprintf(
/* translators: 1: PHP function name, 2: Version number. */
__( 'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$function,
$function_name,
$version
),
E_USER_DEPRECATED
@ -5401,7 +5401,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
trigger_error(
sprintf(
'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$function,
$function_name,
$version,
$replacement
),
@ -5411,7 +5411,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
trigger_error(
sprintf(
'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$function,
$function_name,
$version
),
E_USER_DEPRECATED
@ -5436,12 +5436,12 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
* @since 5.4.0 This function is no longer marked as "private".
* @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
*
* @param string $class The class containing the deprecated constructor.
* @param string $class_name The class containing the deprecated constructor.
* @param string $version The version of WordPress that deprecated the function.
* @param string $parent_class Optional. The parent class calling the deprecated constructor.
* Default empty string.
*/
function _deprecated_constructor( $class, $version, $parent_class = '' ) {
function _deprecated_constructor( $class_name, $version, $parent_class = '' ) {
/**
* Fires when a deprecated constructor is called.
@ -5449,11 +5449,11 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
* @since 4.3.0
* @since 4.5.0 Added the `$parent_class` parameter.
*
* @param string $class The class containing the deprecated constructor.
* @param string $class_name The class containing the deprecated constructor.
* @param string $version The version of WordPress that deprecated the function.
* @param string $parent_class The parent class calling the deprecated constructor.
*/
do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
do_action( 'deprecated_constructor_run', $class_name, $version, $parent_class );
/**
* Filters whether to trigger an error for deprecated functions.
@ -5471,7 +5471,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
sprintf(
/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
__( 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
$class,
$class_name,
$parent_class,
$version,
'<code>__construct()</code>'
@ -5483,7 +5483,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
sprintf(
/* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */
__( 'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$class,
$class_name,
$version,
'<code>__construct()</code>'
),
@ -5495,7 +5495,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
trigger_error(
sprintf(
'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
$class,
$class_name,
$parent_class,
$version,
'<code>__construct()</code>'
@ -5506,7 +5506,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
trigger_error(
sprintf(
'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$class,
$class_name,
$version,
'<code>__construct()</code>'
),
@ -5632,22 +5632,22 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
* @since 5.4.0 This function is no longer marked as "private".
* @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $version The version of WordPress that deprecated the argument used.
* @param string $message Optional. A message regarding the change. Default empty.
*/
function _deprecated_argument( $function, $version, $message = '' ) {
function _deprecated_argument( $function_name, $version, $message = '' ) {
/**
* Fires when a deprecated argument is called.
*
* @since 3.0.0
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $message A message regarding the change.
* @param string $version The version of WordPress that deprecated the argument used.
*/
do_action( 'deprecated_argument_run', $function, $message, $version );
do_action( 'deprecated_argument_run', $function_name, $message, $version );
/**
* Filters whether to trigger an error for deprecated arguments.
@ -5663,7 +5663,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
sprintf(
/* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */
__( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ),
$function,
$function_name,
$version,
$message
),
@ -5674,7 +5674,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
sprintf(
/* translators: 1: PHP function name, 2: Version number. */
__( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$function,
$function_name,
$version
),
E_USER_DEPRECATED
@ -5685,7 +5685,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
trigger_error(
sprintf(
'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s',
$function,
$function_name,
$version,
$message
),
@ -5695,7 +5695,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
trigger_error(
sprintf(
'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.',
$function,
$function_name,
$version
),
E_USER_DEPRECATED
@ -5786,35 +5786,35 @@ function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
* @since 3.1.0
* @since 5.4.0 This function is no longer marked as "private".
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $message A message explaining what has been done incorrectly.
* @param string $version The version of WordPress where the message was added.
*/
function _doing_it_wrong( $function, $message, $version ) {
function _doing_it_wrong( $function_name, $message, $version ) {
/**
* Fires when the given function is being used incorrectly.
*
* @since 3.1.0
*
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $message A message explaining what has been done incorrectly.
* @param string $version The version of WordPress where the message was added.
*/
do_action( 'doing_it_wrong_run', $function, $message, $version );
do_action( 'doing_it_wrong_run', $function_name, $message, $version );
/**
* Filters whether to trigger an error for _doing_it_wrong() calls.
*
* @since 3.1.0
* @since 5.1.0 Added the $function, $message and $version parameters.
* @since 5.1.0 Added the $function_name, $message and $version parameters.
*
* @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
* @param string $function The function that was called.
* @param string $function_name The function that was called.
* @param string $message A message explaining what has been done incorrectly.
* @param string $version The version of WordPress where the message was added.
*/
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) {
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function_name, $message, $version ) ) {
if ( function_exists( '__' ) ) {
if ( $version ) {
/* translators: %s: Version number. */
@ -5831,7 +5831,7 @@ function _doing_it_wrong( $function, $message, $version ) {
sprintf(
/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
__( 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s' ),
$function,
$function_name,
$message,
$version
),
@ -5850,7 +5850,7 @@ function _doing_it_wrong( $function, $message, $version ) {
trigger_error(
sprintf(
'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s',
$function,
$function_name,
$message,
$version
),
@ -5882,10 +5882,10 @@ function is_lighttpd_before_150() {
* @global bool $is_apache
*
* @param string $mod The module, e.g. mod_rewrite.
* @param bool $default Optional. The default return value if the module is not found. Default false.
* @param bool $default_value Optional. The default return value if the module is not found. Default false.
* @return bool Whether the specified module is loaded.
*/
function apache_mod_loaded( $mod, $default = false ) {
function apache_mod_loaded( $mod, $default_value = false ) {
global $is_apache;
if ( ! $is_apache ) {
@ -5915,7 +5915,7 @@ function apache_mod_loaded( $mod, $default = false ) {
}
}
return $default;
return $default_value;
}
/**
@ -7288,23 +7288,23 @@ function reset_mbstring_encoding() {
/**
* Filters/validates a variable as a boolean.
*
* Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`.
* Alternative to `filter_var( $value, FILTER_VALIDATE_BOOLEAN )`.
*
* @since 4.0.0
*
* @param mixed $var Boolean value to validate.
* @param mixed $value Boolean value to validate.
* @return bool Whether the value is validated.
*/
function wp_validate_boolean( $var ) {
if ( is_bool( $var ) ) {
return $var;
function wp_validate_boolean( $value ) {
if ( is_bool( $value ) ) {
return $value;
}
if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
if ( is_string( $value ) && 'false' === strtolower( $value ) ) {
return false;
}
return (bool) $var;
return (bool) $value;
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-54928';
$wp_version = '6.2-alpha-54929';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.