Commit 2ab763418b for wordpress.org

commit 2ab763418b2093f06a2b2ce0afa8bd8c2283cc9c
Author: Weston Ruter <weston@xwp.co>
Date:   Mon Dec 29 19:01:38 2025 +0000

    Script Loader: Warn when a registered style has invalid `path` data and allow inlining empty stylesheets.

    When a stylesheet is registered with a `path` that does not exist or which is not readable, then a `_doing_it_wrong()` is now issued. Previously, paths that did not exist were silently skipped; paths for empty styles were also needlessly skipped, since `wp_filesize()` also returns `0` for the failure case.

    Developed in https://github.com/WordPress/wordpress-develop/pull/10653

    Follow-up to [50836].

    Props westonruter, jonsurrell, soyebsalar01.
    See #52620.
    Fixes #64447.

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


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

diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index a60fce6262..ffb2fffa5c 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -3010,7 +3010,18 @@ function wp_maybe_inline_styles() {
 		$path = $wp_styles->get_data( $handle, 'path' );
 		if ( $path && $src ) {
 			$size = wp_filesize( $path );
-			if ( ! $size ) {
+			if ( 0 === $size && ! file_exists( $path ) ) {
+				_doing_it_wrong(
+					__FUNCTION__,
+					sprintf(
+						/* translators: 1: 'path', 2: filesystem path, 3: style handle */
+						__( 'Unable to read the "%1$s" key with value "%2$s" for stylesheet "%3$s".' ),
+						'path',
+						esc_html( $path ),
+						esc_html( $handle )
+					),
+					'7.0.0'
+				);
 				continue;
 			}
 			$styles[] = array(
@@ -3048,6 +3059,20 @@ function wp_maybe_inline_styles() {
 			}

 			// Get the styles if we don't already have them.
+			if ( ! is_readable( $style['path'] ) ) {
+				_doing_it_wrong(
+					__FUNCTION__,
+					sprintf(
+						/* translators: 1: 'path', 2: filesystem path, 3: style handle */
+						__( 'Unable to read the "%1$s" key with value "%2$s" for stylesheet "%3$s".' ),
+						'path',
+						esc_html( $style['path'] ),
+						esc_html( $style['handle'] )
+					),
+					'7.0.0'
+				);
+				continue;
+			}
 			$style['css'] = file_get_contents( $style['path'] );

 			/*
diff --git a/wp-includes/version.php b/wp-includes/version.php
index cfc463f99f..6224aa8170 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61415';
+$wp_version = '7.0-alpha-61416';

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