Skip to content

Commit

Permalink
fix: restore 404 handling to parse_request()
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Mar 6, 2023
1 parent 0114372 commit 4e5b4dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Data/NodeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function parse_request( string $uri, $extra_query_vars = '' ) {
$error = '404';
if ( ! empty( $rewrite ) ) {
// If we match a rewrite rule, this will be cleared.
$error = null;
$error = '404';
$this->wp->did_permalink = true;

$pathinfo = ! empty( $uri ) ? $uri : '';
Expand Down Expand Up @@ -460,9 +460,14 @@ public function parse_request( string $uri, $extra_query_vars = '' ) {
// Substitute the substring matches into the query.
$query = addslashes( \WP_MatchesMapRegex::apply( $query, $matches ) ); // @phpstan-ignore-line

$this->wp->matched_query = $query;

// 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 ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
unset( $error );
}
}
}

Expand Down

0 comments on commit 4e5b4dc

Please sign in to comment.