From d30c9de4dfa565c13348b6a8d6290b083b43d242 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Tue, 17 Dec 2024 10:20:47 +0100 Subject: [PATCH] Fix overwriting array keys The + operator merges arrays with key overwriting. array_merge renumbers numeric arrays, the desired behavior in this case. --- src/wp-includes/class-wp-script-modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-script-modules.php b/src/wp-includes/class-wp-script-modules.php index 0a1408d003248..e41d1004350c9 100644 --- a/src/wp-includes/class-wp-script-modules.php +++ b/src/wp-includes/class-wp-script-modules.php @@ -305,7 +305,7 @@ public function print_import_map() { */ private function get_import_map(): array { $imports = array(); - $script_module_ids = $this->marked_for_inclusion + array_keys( $this->get_marked_for_enqueue() ); + $script_module_ids = array_merge( $this->marked_for_inclusion, array_keys( $this->get_marked_for_enqueue() ) ); foreach ( $this->get_dependencies( $script_module_ids ) as $id => $script_module ) { $src = $this->get_src( $id );