Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#46064 closed enhancement (invalid)

Check for protected endpoint is done twice in a row

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

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 6 years ago.

Download all attachments as: .zip

Change History (7)

@schlessera
6 years ago

#1 @schlessera
6 years 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
6 years ago

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

#3 @pento
6 years ago

  • Keywords servehappy added
  • Milestone changed from 5.1 to 5.2

#4 @flixos90
6 years ago

  • Milestone changed from 5.2 to 5.3

#5 @flixos90
6 years 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
6 years ago

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