Commit 759decd498 for wordpress.org
commit 759decd49851fb1dc11e3aceec592b392a9b22b6
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Thu Oct 8 15:05:51 2026 +0000
Code Quality: Remove an always-true check when clearing the 404 error in `WP` class.
In `WP::parse_request()`, `$error` is set to `'404'` and is not changed again before the `'404' === $error` check that clears it once a rewrite rule matches. The check therefore always passes and is removed. There is no change in behavior.
This resolves one error in the `identical.alwaysTrue` PHPStan baseline.
Developed in https://github.com/WordPress/wordpress-develop/pull/14006.
Follow-up to r2627, r21818, r56362.
Props Soean.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@64244
git-svn-id: http://core.svn.wordpress.org/trunk@63395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php
index 1cfa0df8f6..92cf4b9572 100644
--- a/wp-includes/class-wp.php
+++ b/wp-includes/class-wp.php
@@ -277,10 +277,8 @@ class WP {
// Parse the query.
parse_str( $query, $perma_query_vars );
- // If we're processing a 404 request, clear the error var since we found something.
- if ( '404' === $error ) {
- unset( $error, $_GET['error'] );
- }
+ // Clear the 404 error var since we found something.
+ unset( $error, $_GET['error'] );
}
// If req_uri is empty or if it is a request for ourself, unset error.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 827d120cea..b65bf50db3 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64243';
+$wp_version = '7.2-alpha-64244';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.