WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 7 months ago

Last modified 4 months ago

#46064 closed enhancement (invalid)

Check for protected endpoint is done twice in a row

Reported by: schlessera Owned by:
Milestone: Priority: normal
Severity: minor Version: 5.1
Component: Site Health Keywords: has-patch servehappy
Focuses: Cc:
PR Number:

Description

The following piece of code is found in WP_Fatal_Error_Handler::handle():

<?php
// If the error was stored and thus the extension paused,
// redirect the request to catch multiple errors in one go.
if ( $this->store_error( $error ) ) {
        $this->redirect_protected();
}

Both of these methods start with an early bail check to assert it is indeed a protected endpoint, which is wasteful.

Attachments (1)

46064.diff (693 bytes) - added by schlessera 9 months ago.

Download all attachments as: .zip

Change History (7)

@schlessera
9 months ago

#1 @schlessera
9 months ago

I suggest just removing the second check, as that method is protected and only ever called within the conditional that calls the store() method.

#2 @ocean90
9 months ago

While we're here, can we change wp_redirect() to wp_safe_redirect()?

#3 @pento
9 months ago

  • Keywords servehappy added
  • Milestone changed from 5.1 to 5.2

#4 @flixos90
7 months ago

  • Milestone changed from 5.2 to 5.3

#5 @flixos90
7 months ago

  • Milestone 5.3 deleted
  • Resolution set to invalid
  • Status changed from new to closed

This ticket is based on the old fatal error recovery mode implementation and will be covered as part of #46130.

#6 @spacedmonkey
4 months ago

  • Component changed from Bootstrap/Load to Site Health
Note: See TracTickets for help on using tickets.