diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index f7d820d85559f..baa5e36583db0 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -367,4 +367,13 @@
/tests/*
+
+
+ error
+
+
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 2af08fba70af9..cddf7d24cceeb 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -2432,7 +2432,7 @@ function wp_ajax_save_widget() {
}
ob_start();
- call_user_func_array( $control['callback'], $control['params'] );
+ call_user_func_array( $control['callback'], wp_normalize_call_user_func_args( $control['params'] ) );
ob_end_clean();
break;
}
@@ -2451,7 +2451,7 @@ function wp_ajax_save_widget() {
$form = $wp_registered_widget_controls[ $widget_id ];
if ( $form ) {
- call_user_func_array( $form['callback'], $form['params'] );
+ call_user_func_array( $form['callback'], wp_normalize_call_user_func_args( $form['params'] ) );
}
wp_die();
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
index 838f0795cd5d3..f1d39ad3f59e4 100644
--- a/src/wp-admin/includes/class-wp-screen.php
+++ b/src/wp-admin/includes/class-wp-screen.php
@@ -913,7 +913,7 @@ public function render_screen_meta() {
// If it exists, fire tab callback.
if ( ! empty( $tab['callback'] ) ) {
- call_user_func_array( $tab['callback'], array( $this, $tab ) );
+ call_user_func_array( $tab['callback'], wp_normalize_call_user_func_args( array( $this, $tab ) ) );
}
?>
diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
index 5415e5961bf7b..d8a7c863a19c2 100644
--- a/src/wp-admin/includes/dashboard.php
+++ b/src/wp-admin/includes/dashboard.php
@@ -1212,7 +1212,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
if ( $callback && is_callable( $callback ) ) {
array_unshift( $args, $widget_id, $check_urls );
ob_start();
- call_user_func_array( $callback, $args );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $args ) );
// Default lifetime in cache of 12 hours (same as the feeds).
set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
}
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index f4fd963ae5d8e..4755e714b4291 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -635,7 +635,7 @@ function wp_iframe( $content_func, ...$args ) {
meta_box_sanitize_cb ) ) {
- $translated['tax_input'][ $taxonomy ] = call_user_func_array( $tax_object->meta_box_sanitize_cb, array( $taxonomy, $terms ) );
+ $translated['tax_input'][ $taxonomy ] = call_user_func_array( $tax_object->meta_box_sanitize_cb, wp_normalize_call_user_func_args( array( $taxonomy, $terms ) ) );
}
}
}
diff --git a/src/wp-admin/includes/widgets.php b/src/wp-admin/includes/widgets.php
index e751602866b0d..86a6863f4678c 100644
--- a/src/wp-admin/includes/widgets.php
+++ b/src/wp-admin/includes/widgets.php
@@ -273,7 +273,7 @@ function wp_widget_control( $sidebar_args ) {
" . __( 'There are no options for this widget.' ) . "
\n";
}
diff --git a/src/wp-admin/widgets-form.php b/src/wp-admin/widgets-form.php
index 85ace96796555..ecaaa72784b72 100644
--- a/src/wp-admin/widgets-form.php
+++ b/src/wp-admin/widgets-form.php
@@ -177,7 +177,7 @@
}
ob_start();
- call_user_func_array( $control['callback'], $control['params'] );
+ call_user_func_array( $control['callback'], wp_normalize_call_user_func_args( $control['params'] ) );
ob_end_clean();
break;
@@ -290,7 +290,7 @@
' . __( 'There are no options for this widget.' ) . "\n";
}
diff --git a/src/wp-includes/class-wp-block-bindings-source.php b/src/wp-includes/class-wp-block-bindings-source.php
index b71f020e28e57..01a1f35c45051 100644
--- a/src/wp-includes/class-wp-block-bindings-source.php
+++ b/src/wp-includes/class-wp-block-bindings-source.php
@@ -83,6 +83,7 @@ public function __construct( string $name, array $source_properties ) {
* @return mixed The value of the source.
*/
public function get_value( array $source_args, $block_instance, string $attribute_name ) {
+ // Safe: Array is built internally with numeric keys, not from untrusted input.
$value = call_user_func_array( $this->get_value_callback, array( $source_args, $block_instance, $attribute_name ) );
/**
* Filters the output of a block bindings source.
diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php
index 14132b6e55728..491427eb4aa2d 100644
--- a/src/wp-includes/class-wp-customize-widgets.php
+++ b/src/wp-includes/class-wp-customize-widgets.php
@@ -1631,7 +1631,7 @@ public function call_widget_update( $widget_id ) {
foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) {
ob_start();
- call_user_func_array( $control['callback'], $control['params'] );
+ call_user_func_array( $control['callback'], wp_normalize_call_user_func_args( $control['params'] ) );
ob_end_clean();
break;
}
@@ -1677,7 +1677,7 @@ public function call_widget_update( $widget_id ) {
ob_start();
$form = $wp_registered_widget_controls[ $widget_id ];
if ( $form ) {
- call_user_func_array( $form['callback'], $form['params'] );
+ call_user_func_array( $form['callback'], wp_normalize_call_user_func_args( $form['params'] ) );
}
$form = ob_get_clean();
diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php
index cd6860c0f81f2..e7644c6ba7e48 100644
--- a/src/wp-includes/class-wp-hook.php
+++ b/src/wp-includes/class-wp-hook.php
@@ -338,7 +338,7 @@ public function apply_filters( $value, $args ) {
if ( 0 === $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
- $value = call_user_func_array( $the_['function'], $args );
+ $value = call_user_func_array( $the_['function'], wp_normalize_call_user_func_args( $args ) );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, $the_['accepted_args'] ) );
}
@@ -378,6 +378,7 @@ public function do_action( $args ) {
* @param array $args Arguments to pass to the hook callbacks. Passed by reference.
*/
public function do_all_hook( &$args ) {
+ $callback_args = wp_normalize_call_user_func_args( $args );
$nesting_level = $this->nesting_level++;
$this->iterations[ $nesting_level ] = $this->priorities;
@@ -385,7 +386,7 @@ public function do_all_hook( &$args ) {
$priority = current( $this->iterations[ $nesting_level ] );
foreach ( $this->callbacks[ $priority ] as $the_ ) {
- call_user_func_array( $the_['function'], $args );
+ call_user_func_array( $the_['function'], $callback_args );
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
diff --git a/src/wp-includes/class-wp-image-editor.php b/src/wp-includes/class-wp-image-editor.php
index d7fe151a0d94a..917e44112a895 100644
--- a/src/wp-includes/class-wp-image-editor.php
+++ b/src/wp-includes/class-wp-image-editor.php
@@ -574,7 +574,7 @@ protected function make_image( $filename, $callback, $arguments ) {
wp_mkdir_p( dirname( $filename ) );
}
- $result = call_user_func_array( $callback, $arguments );
+ $result = call_user_func_array( $callback, wp_normalize_call_user_func_args( $arguments ) );
if ( $result && $stream ) {
$contents = ob_get_contents();
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 85b6043b0b5c8..0e66fce3f30ee 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -7162,9 +7162,9 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar
while (
$tortoise
&&
- ( $evanescent_hare = $override[ $hare ] ?? call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
+ ( $evanescent_hare = $override[ $hare ] ?? call_user_func_array( $callback, wp_normalize_call_user_func_args( array_merge( array( $hare ), $callback_args ) ) ) )
&&
- ( $hare = $override[ $evanescent_hare ] ?? call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
+ ( $hare = $override[ $evanescent_hare ] ?? call_user_func_array( $callback, wp_normalize_call_user_func_args( array_merge( array( $evanescent_hare ), $callback_args ) ) ) )
) {
if ( $_return_loop ) {
$return[ $tortoise ] = true;
@@ -7178,7 +7178,7 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar
}
// Increment tortoise by one step.
- $tortoise = $override[ $tortoise ] ?? call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
+ $tortoise = $override[ $tortoise ] ?? call_user_func_array( $callback, wp_normalize_call_user_func_args( array_merge( array( $tortoise ), $callback_args ) ) );
}
return false;
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index 27c58b57dd671..fb2d94a59ef14 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -2047,3 +2047,26 @@ function wp_is_site_protected_by_basic_auth( $context = '' ) {
*/
return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context );
}
+
+/**
+ * Normalizes an argument array for use with call_user_func_array() across PHP versions.
+ *
+ * PHP 8.0+ interprets string array keys as parameter names. In PHP 7.x, string keys were
+ * ignored when passing arguments positionally.
+ *
+ * @param array $args Arguments for the callback.
+ * @return array Positional argument list.
+ */
+function wp_normalize_call_user_func_args( $args ) {
+ if ( ! is_array( $args ) ) {
+ return $args;
+ }
+
+ foreach ( $args as $key => $unused ) {
+ if ( is_string( $key ) ) {
+ return array_values( $args );
+ }
+ }
+
+ return $args;
+}
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-categories-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-categories-controller.php
index 2156109e53b32..67c9263b2ecab 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-categories-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-categories-controller.php
@@ -184,16 +184,16 @@ public function get_item_permissions_check( $request ) {
*
* @since 6.9.0
*
- * @param WP_Ability_Category $category The ability category object.
+ * @param WP_Ability_Category $item The ability category object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
- public function prepare_item_for_response( $category, $request ) {
+ public function prepare_item_for_response( $item, $request ) {
$data = array(
- 'slug' => $category->get_slug(),
- 'label' => $category->get_label(),
- 'description' => $category->get_description(),
- 'meta' => $category->get_meta(),
+ 'slug' => $item->get_slug(),
+ 'label' => $item->get_label(),
+ 'description' => $item->get_description(),
+ 'meta' => $item->get_meta(),
);
$context = $request['context'] ?? 'view';
@@ -206,13 +206,13 @@ public function prepare_item_for_response( $category, $request ) {
if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
$links = array(
'self' => array(
- 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $category->get_slug() ) ),
+ 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $item->get_slug() ) ),
),
'collection' => array(
'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
),
'abilities' => array(
- 'href' => rest_url( sprintf( '%s/abilities?category=%s', $this->namespace, $category->get_slug() ) ),
+ 'href' => rest_url( sprintf( '%s/abilities?category=%s', $this->namespace, $item->get_slug() ) ),
),
);
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php
index e3ce0c4f2e03e..2e3e9abe8c246 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php
@@ -295,23 +295,23 @@ private function strip_internal_schema_keywords( array $schema ): array {
*
* @since 6.9.0
*
- * @param WP_Ability $ability The ability object.
+ * @param WP_Ability $item The ability object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
- public function prepare_item_for_response( $ability, $request ) {
+ public function prepare_item_for_response( $item, $request ) {
$data = array(
- 'name' => $ability->get_name(),
- 'label' => $ability->get_label(),
- 'description' => $ability->get_description(),
- 'category' => $ability->get_category(),
+ 'name' => $item->get_name(),
+ 'label' => $item->get_label(),
+ 'description' => $item->get_description(),
+ 'category' => $item->get_category(),
'input_schema' => $this->strip_internal_schema_keywords(
- $this->normalize_schema_empty_object_defaults( $ability->get_input_schema() )
+ $this->normalize_schema_empty_object_defaults( $item->get_input_schema() )
),
'output_schema' => $this->strip_internal_schema_keywords(
- $this->normalize_schema_empty_object_defaults( $ability->get_output_schema() )
+ $this->normalize_schema_empty_object_defaults( $item->get_output_schema() )
),
- 'meta' => $ability->get_meta(),
+ 'meta' => $item->get_meta(),
);
$context = $request['context'] ?? 'view';
@@ -324,7 +324,7 @@ public function prepare_item_for_response( $ability, $request ) {
if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
$links = array(
'self' => array(
- 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $ability->get_name() ) ),
+ 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $item->get_name() ) ),
),
'collection' => array(
'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
@@ -332,7 +332,7 @@ public function prepare_item_for_response( $ability, $request ) {
);
$links['wp:action-run'] = array(
- 'href' => rest_url( sprintf( '%s/%s/%s/run', $this->namespace, $this->rest_base, $ability->get_name() ) ),
+ 'href' => rest_url( sprintf( '%s/%s/%s/run', $this->namespace, $this->rest_base, $item->get_name() ) ),
);
$response->add_links( $links );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
index 11b1478537ed7..4ae465ec05134 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
@@ -303,12 +303,12 @@ protected function prepare_item_for_database( $request ) {
* @since 5.9.0
* @since 6.6.0 Added custom relative theme file URIs to `_links`.
*
- * @param WP_Post $post Global Styles post object.
+ * @param WP_Post $item Global Styles post object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
- public function prepare_item_for_response( $post, $request ) {
- $raw_config = json_decode( $post->post_content, true );
+ public function prepare_item_for_response( $item, $request ) {
+ $raw_config = json_decode( $item->post_content, true );
$is_global_styles_user_theme_json = isset( $raw_config['isGlobalStylesUserThemeJSON'] ) && true === $raw_config['isGlobalStylesUserThemeJSON'];
$config = array();
$theme_json = null;
@@ -322,20 +322,20 @@ public function prepare_item_for_response( $post, $request ) {
$data = array();
if ( rest_is_field_included( 'id', $fields ) ) {
- $data['id'] = $post->ID;
+ $data['id'] = $item->ID;
}
if ( rest_is_field_included( 'title', $fields ) ) {
$data['title'] = array();
}
if ( rest_is_field_included( 'title.raw', $fields ) ) {
- $data['title']['raw'] = $post->post_title;
+ $data['title']['raw'] = $item->post_title;
}
if ( rest_is_field_included( 'title.rendered', $fields ) ) {
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
add_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
- $data['title']['rendered'] = get_the_title( $post->ID );
+ $data['title']['rendered'] = get_the_title( $item->ID );
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
@@ -357,7 +357,7 @@ public function prepare_item_for_response( $post, $request ) {
$response = rest_ensure_response( $data );
if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
- $links = $this->prepare_links( $post->ID );
+ $links = $this->prepare_links( $item->ID );
// Only return resolved URIs for get requests to user theme JSON.
if ( $theme_json ) {
@@ -369,7 +369,7 @@ public function prepare_item_for_response( $post, $request ) {
$response->add_links( $links );
if ( ! empty( $links['self']['href'] ) ) {
- $actions = $this->get_available_actions( $post, $request );
+ $actions = $this->get_available_actions( $item, $request );
$self = $links['self']['href'];
foreach ( $actions as $rel ) {
$response->add_link( $rel, $self );
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
index c5d4e89e5e1d3..1dff954157ddb 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
@@ -290,18 +290,18 @@ public function get_items( $request ) {
* @since 6.3.0
* @since 6.6.0 Added resolved URI links to the response.
*
- * @param WP_Post $post Post revision object.
+ * @param WP_Post $item Post revision object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response|WP_Error Response object.
*/
- public function prepare_item_for_response( $post, $request ) {
+ public function prepare_item_for_response( $item, $request ) {
// Don't prepare the response body for HEAD requests.
if ( $request->is_method( 'HEAD' ) ) {
return new WP_REST_Response( array() );
}
$parent = $this->get_parent( $request['parent'] );
- $global_styles_config = $this->get_decoded_global_styles_json( $post->post_content );
+ $global_styles_config = $this->get_decoded_global_styles_json( $item->post_content );
if ( is_wp_error( $global_styles_config ) ) {
return $global_styles_config;
@@ -332,27 +332,27 @@ public function prepare_item_for_response( $post, $request ) {
}
if ( rest_is_field_included( 'author', $fields ) ) {
- $data['author'] = (int) $post->post_author;
+ $data['author'] = (int) $item->post_author;
}
if ( rest_is_field_included( 'date', $fields ) ) {
- $data['date'] = $this->prepare_date_response( $post->post_date_gmt, $post->post_date );
+ $data['date'] = $this->prepare_date_response( $item->post_date_gmt, $item->post_date );
}
if ( rest_is_field_included( 'date_gmt', $fields ) ) {
- $data['date_gmt'] = $this->prepare_date_response( $post->post_date_gmt );
+ $data['date_gmt'] = $this->prepare_date_response( $item->post_date_gmt );
}
if ( rest_is_field_included( 'id', $fields ) ) {
- $data['id'] = (int) $post->ID;
+ $data['id'] = (int) $item->ID;
}
if ( rest_is_field_included( 'modified', $fields ) ) {
- $data['modified'] = $this->prepare_date_response( $post->post_modified_gmt, $post->post_modified );
+ $data['modified'] = $this->prepare_date_response( $item->post_modified_gmt, $item->post_modified );
}
if ( rest_is_field_included( 'modified_gmt', $fields ) ) {
- $data['modified_gmt'] = $this->prepare_date_response( $post->post_modified_gmt );
+ $data['modified_gmt'] = $this->prepare_date_response( $item->post_modified_gmt );
}
if ( rest_is_field_included( 'parent', $fields ) ) {
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
index 3947bfd6107ce..f4eb9d7bf8cdf 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
@@ -116,12 +116,12 @@ protected function check_has_read_only_access( $request ) {
*
* @since 5.9.0
*
- * @param WP_Term $term Term object.
+ * @param WP_Term $item Term object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
- public function prepare_item_for_response( $term, $request ) {
- $nav_menu = wp_get_nav_menu_object( $term );
+ public function prepare_item_for_response( $item, $request ) {
+ $nav_menu = wp_get_nav_menu_object( $item );
$response = parent::prepare_item_for_response( $nav_menu, $request );
$fields = $this->get_fields_for_response( $request );
@@ -142,11 +142,11 @@ public function prepare_item_for_response( $term, $request ) {
$response = rest_ensure_response( $data );
if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
- $response->add_links( $this->prepare_links( $term ) );
+ $response->add_links( $this->prepare_links( $item ) );
}
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
- return apply_filters( "rest_prepare_{$this->taxonomy}", $response, $term, $request );
+ return apply_filters( "rest_prepare_{$this->taxonomy}", $response, $item, $request );
}
/**
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
index 9b25298c347ba..953fee0cefda9 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
@@ -422,7 +422,7 @@ public function delete_item( $request ) {
if ( is_callable( $callback ) ) {
ob_start();
- call_user_func_array( $callback, $params );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $params ) );
ob_end_clean();
}
@@ -621,7 +621,7 @@ protected function save_widget( $request, $sidebar_id ) {
if ( is_callable( $callback ) ) {
ob_start();
- call_user_func_array( $callback, $params );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $params ) );
ob_end_clean();
}
diff --git a/src/wp-includes/utf8.php b/src/wp-includes/utf8.php
index da10838f233d1..4355f3f73abdb 100644
--- a/src/wp-includes/utf8.php
+++ b/src/wp-includes/utf8.php
@@ -47,9 +47,11 @@ function wp_is_valid_utf8( string $bytes ): bool {
* @private
*
* @since 6.9.0
+ *
+ * Note: The `$string` parameter was renamed to `$bytes` for PHP 8.0 named argument compatibility.
*/
- function wp_is_valid_utf8( string $string ): bool {
- return _wp_is_valid_utf8_fallback( $string );
+ function wp_is_valid_utf8( string $bytes ): bool {
+ return _wp_is_valid_utf8_fallback( $bytes );
}
endif;
diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php
index 7a3cb5673a4fa..4d80cae788805 100644
--- a/src/wp-includes/widgets.php
+++ b/src/wp-includes/widgets.php
@@ -844,7 +844,7 @@ function dynamic_sidebar( $index = 1 ) {
do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] );
if ( is_callable( $callback ) ) {
- call_user_func_array( $callback, $params );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $params ) );
$did_one = true;
}
}
@@ -2054,7 +2054,7 @@ function wp_render_widget( $widget_id, $sidebar_id ) {
do_action( 'dynamic_sidebar', $wp_registered_widgets[ $widget_id ] );
if ( is_callable( $callback ) ) {
- call_user_func_array( $callback, $params );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $params ) );
}
return ob_get_clean();
@@ -2083,7 +2083,7 @@ function wp_render_widget_control( $id ) {
ob_start();
if ( is_callable( $callback ) ) {
- call_user_func_array( $callback, $params );
+ call_user_func_array( $callback, wp_normalize_call_user_func_args( $params ) );
}
return ob_get_clean();