Make WordPress Core

Changeset 64244


Ignore:
Timestamp:
10/08/2026 03:04:03 PM (4 hours ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r64073 r64244  
    278278                                parse_str( $query, $perma_query_vars );
    279279
    280                                 // If we're processing a 404 request, clear the error var since we found something.
    281                                 if ( '404' === $error ) {
    282                                         unset( $error, $_GET['error'] );
    283                                 }
     280                                // Clear the 404 error var since we found something.
     281                                unset( $error, $_GET['error'] );
    284282                        }
    285283
  • trunk/tests/phpstan/baselines/identical.alwaysTrue.neon

    r63929 r64244  
    2525                        path: ../../../src/wp-admin/includes/class-file-upload-upgrader.php
    2626                -
    27                         message: '#^Strict comparison using \=\=\= between ''404'' and ''404'' will always evaluate to true\.$#'
    28                         identifier: identical.alwaysTrue
    29                         count: 1
    30                         path: ../../../src/wp-includes/class-wp.php
    31                 -
    3227                        message: '#^Strict comparison using \=\=\= between true and true will always evaluate to true\.$#'
    3328                        identifier: identical.alwaysTrue
Note: See TracChangeset for help on using the changeset viewer.