From b27a924101f6e08d247c2ecc83ad57d2293ea297 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sat, 7 May 2022 02:53:11 +0000 Subject: [PATCH] Script Loader: Fix i18n edge case breaking dependencies. Prevent concatenation of scripts if the text domain is defined to ensure the dependency order is respected. This accounts for an edge case in which replacing a core script via a plugin and a lack of translations (eg, for a US English site) could cause the JavaScript files to be ordered incorrectly. Follow up to [52937]. Props audrasjb, boniu91, chaion07, costdev, hellofromtonya, jsnajdr, mukesh27, ndiego, ugyensupport. Fixes #55628. Built from https://develop.svn.wordpress.org/trunk@53360 git-svn-id: http://core.svn.wordpress.org/trunk@52949 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-scripts.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index aebf3a3b59..246d1fe6a2 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -311,6 +311,8 @@ class WP_Scripts extends WP_Dependencies { $inline_script_tag = ''; } + $translations_stop_concat = ! empty( $obj->textdomain ); + $translations = $this->print_translations( $handle, false ); if ( $translations ) { $translations = sprintf( "\n%s\n\n", $this->type_attr, esc_attr( $handle ), $translations ); @@ -327,7 +329,7 @@ class WP_Scripts extends WP_Dependencies { */ $srce = apply_filters( 'script_loader_src', $src, $handle ); - if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) { + if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) { $this->do_concat = false; // Have to print the so-far concatenated scripts right away to maintain the right order. diff --git a/wp-includes/version.php b/wp-includes/version.php index a6646004c0..d2ef383ec1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53358'; +$wp_version = '6.1-alpha-53360'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.