From 572f1725d95e54ea8ffcec6df48d2a9ab33fab3e Mon Sep 17 00:00:00 2001 From: gziolo Date: Tue, 7 Jan 2020 15:28:05 +0000 Subject: [PATCH] Build Tools: do not include assets for JS dependencies that do not exist. This is a follow-up for #48154, where we started including *.asset.php files to declare package dependencies. This works well but creates warnings in environments where the package does not exist because WordPress was not fully built. Props jeherve, swissspidy. Fixes #49144. Built from https://develop.svn.wordpress.org/trunk@47048 git-svn-id: http://core.svn.wordpress.org/trunk@46848 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 11 ++++++++--- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 0267f9cd11..9fa1ec0a23 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -285,9 +285,14 @@ function wp_default_packages_scripts( &$scripts ) { ); foreach ( $packages as $package ) { - $handle = 'wp-' . $package; - $path = "/wp-includes/js/dist/$package$suffix.js"; - $asset_file = include( ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php" ); + $handle = 'wp-' . $package; + $path = "/wp-includes/js/dist/$package$suffix.js"; + + if ( ! file_exists( ABSPATH . $path ) ) { + continue; + } + + $asset_file = include ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php"; $dependencies = $asset_file['dependencies']; // Add dependencies that cannot be detected and generated by build tools. diff --git a/wp-includes/version.php b/wp-includes/version.php index 313ba01545..40fd314089 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47047'; +$wp_version = '5.4-alpha-47048'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.