Commit 6643a89ba0 for wordpress.org
commit 6643a89ba0ec8e1de5e06452015953200a942290
Author: westonruter <westonruter@git.wordpress.org>
Date: Wed Nov 25 20:26:55 2026 +0000
Code Quality: Resolve the identical.alwaysFalse PHPStan errors.
In `wp_rand()` the `3000000000 === 2147483647` comparison was added in r21685 to detect misconfigured 32-bit PHP builds (Entropy PHP, for example) that truncate integer literals larger than `PHP_INT_MAX` instead of overflowing them to floats, so that `0xffffffff` could be built from a string cast to a float on them. PHPStan evaluates the literals as a 64-bit build does, so it reported the comparison as always false. It is replaced with a `PHP_INT_SIZE` check, which uses the explicit float on every 32-bit build. Behavior is unchanged, since on a correctly configured 32-bit build the literal already overflows to the same float. This empties the baseline, so it is removed.
The `identical.alwaysFalse` ignore for `WP_HTML_Processor::step()` in `phpstan.neon.dist` remains, since that report is a false positive for the bookmark exhaustion guards added in r61755, which are intentional.
Developed in https://github.com/WordPress/wordpress-develop/pull/13782.
Follow-up to r21685, r63023.
Props arshidkv12, westonruter, mukesh27.
See #66739.
Built from https://develop.svn.wordpress.org/trunk@65792
git-svn-id: http://core.svn.wordpress.org/trunk@64821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 0093f2a33f..46995a9e8a 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -3054,10 +3054,11 @@ if ( ! function_exists( 'wp_rand' ) ) :
global $rnd_value;
/*
- * Some misconfigured 32-bit environments (Entropy PHP, for example)
- * truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
+ * On 32-bit systems, 0xffffffff exceeds PHP_INT_MAX, so it is cast to a float explicitly.
+ * Some misconfigured 32-bit environments (Entropy PHP, for example) truncate integer literals
+ * larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
*/
- $max_random_number = 3000000000 === 2147483647 ? (float) '4294967295' : 4294967295; // 4294967295 = 0xffffffff
+ $max_random_number = PHP_INT_SIZE === 4 ? (float) '4294967295' : 4294967295; // 4294967295 = 0xffffffff
if ( null === $min ) {
$min = 0;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 137bb57bde..14f72bdca9 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65791';
+$wp_version = '7.3-alpha-65792';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.