Commit 3c4a2aea6c for wordpress.org

commit 3c4a2aea6c1f0ba0b4bc6cb2aeb595a7873790d1
Author: westonruter <westonruter@git.wordpress.org>
Date:   Wed Oct 21 04:39:00 2026 +0000

    Build/Test Tools: Add types for dynamic constants in PHPStan.

    PHPStan treated many install-dependent constants as fixed values. Those missing from `dynamicConstantNames` took their placeholder value from the PHPStan bootstrap, and listed ones without a type took the type of their only visible definition. For `WP_DEBUG_LOG` that definition was `false`, so the `is_string()` checks for a log file path in `wp_debug_mode()` and `WP_Debug_Data` were reported as impossible.

    Every install-dependent constant now has an explicit type, including those the bootstrap had pinned, such as the content and plugin paths, the cookie names, the memory limits, and the timeouts. Each type is what core expects: the values it defines and documents, and that its reads are designed for. Where real-world configurations are known to define wider values, most often by passing `getenv()` through unconverted, a comment notes them along with how core handles them. Widening the types to cover such values instead would require handling invalid configuration at every read.

    The bootstrap definitions remain, since PHPStan does not discover constants that core defines inside a function, but their values no longer affect the analysis. The `preg_replace()` results that define the cookie paths are cast to strings to fit their types, and the PHPUnit bootstrap now defines the memory limits as strings to match theirs.

    Developed in https://github.com/WordPress/wordpress-develop/pull/14034.
    Follow-up to r61699, r62965, r63191, r63356.

    Props rahultank, westonruter.
    See #65817.

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


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

diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
index 4502196436..f0dd41c9f6 100644
--- a/wp-admin/press-this.php
+++ b/wp-admin/press-this.php
@@ -22,7 +22,7 @@ function wp_load_press_this() {
 			403
 		);
 	} elseif ( is_plugin_active( $plugin_file ) ) {
-		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; // @phpstan-ignore include.fileNotFound
+		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
 		$wp_press_this = new WP_Press_This_Plugin(); // @phpstan-ignore class.notFound
 		$wp_press_this->html();
 	} elseif ( current_user_can( 'activate_plugins' ) ) {
diff --git a/wp-includes/default-constants.php b/wp-includes/default-constants.php
index d4c669ff4c..11d2bc4338 100644
--- a/wp-includes/default-constants.php
+++ b/wp-includes/default-constants.php
@@ -301,14 +301,14 @@ function wp_cookie_constants() {
 	 * @since 1.2.0
 	 */
 	if ( ! defined( 'COOKIEPATH' ) ) {
-		define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
+		define( 'COOKIEPATH', (string) preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
 	}

 	/**
 	 * @since 1.5.0
 	 */
 	if ( ! defined( 'SITECOOKIEPATH' ) ) {
-		define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
+		define( 'SITECOOKIEPATH', (string) preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
 	}

 	/**
@@ -322,7 +322,7 @@ function wp_cookie_constants() {
 	 * @since 2.6.0
 	 */
 	if ( ! defined( 'PLUGINS_COOKIE_PATH' ) ) {
-		define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
+		define( 'PLUGINS_COOKIE_PATH', (string) preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
 	}

 	/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index a5783e7b46..408f4b7800 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta1-64671';
+$wp_version = '7.2-beta1-64672';

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