Commit a9993710ef for wordpress.org

commit a9993710ef832aa5a874bcde30a7a62765ee019d
Author: westonruter <westonruter@git.wordpress.org>
Date:   Tue Nov 3 00:22:54 2026 +0000

    Script Loader: Ignore image preloads that have no URL.

    An image resource passed through the `wp_preload_resources` filter without an `href` was accepted when it had either `imagesrcset` or `imagesizes`, but `imagesrcset` was always used as the key for removing duplicates. A resource with only `imagesizes` therefore raised an undefined array key warning (plus a null array offset deprecation on PHP 8.5), collapsed every such resource onto the same empty key, and printed a `<link>` with no URL at all, since `imagesizes` is only output alongside `imagesrcset`. A resource with neither `href` nor `as` raised a warning as well.

    Such a resource is now skipped unless `as` is `image` and `imagesrcset` is set. PHPStan reports the missing offsets once the filter's value is typed from its documented hash notation.

    Developed in https://github.com/WordPress/wordpress-develop/pull/15380.
    Follow-up to r53846.

    Props westonruter, adamsilverstein.
    See #65817.

    Built from https://develop.svn.wordpress.org/trunk@65215


    git-svn-id: http://core.svn.wordpress.org/trunk@64364 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 5d6786db99..9826ab0633 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -4107,9 +4107,7 @@ function wp_preload_resources() {
 			}
 			$unique_resources[ $href ] = $attributes;
 			// Media can use imagesrcset and not href.
-		} elseif ( ( 'image' === $resource['as'] ) &&
-			( isset( $resource['imagesrcset'] ) || isset( $resource['imagesizes'] ) )
-		) {
+		} elseif ( isset( $resource['as'], $resource['imagesrcset'] ) && 'image' === $resource['as'] ) {
 			if ( isset( $unique_resources[ $resource['imagesrcset'] ] ) ) {
 				continue;
 			}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 234c355a90..6b5825035f 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta3-65214';
+$wp_version = '7.2-beta3-65215';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.