[wp-trac] [WordPress Trac] #52560: Fatal error handler references recovery mode email, which may not have actually been sent

WordPress Trac noreply at wordpress.org
Wed Feb 17 18:15:15 UTC 2021


#52560: Fatal error handler references recovery mode email, which may not have
actually been sent
----------------------------+-----------------------------
 Reporter:  stevegrunwell   |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Bootstrap/Load  |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 In troubleshooting a client issue, I've stumbled upon a potential cause
 for some of the trac tickets regarding the recovery email not being sent
 (e.g. #52201, #51634, #52207, and others):

 The recovery mode email is
 [https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-
 recovery-mode.php#L184 sent from within the
 WP_Recovery_Mode::handle_error() method], but that method is
 [https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-
 fatal-error-handler.php#L51 only called by the fatal error handler] if
 {{{WP_Recovery_Mode}}} has been initialized.

 This initialization [https://github.com/WordPress/WordPress/blob/master
 /wp-settings.php#L385 occurs in wp-settings.php] **after** the MU plugins
 have been loaded; as a result, {{{WP_Recovery_Mode::handle_error()}}} will
 not be called for any errors that occur during the loading of MU plugins
 (or anywhere else prior to initialization).

 Meanwhile, [https://github.com/WordPress/WordPress/blob/master/wp-includes
 /class-wp-fatal-error-handler.php#L185 the messaging for the default error
 template] uses {{{is_protected_endpoint()}}} as its sole criteria for
 whether it should include the "Please check your site admin email inbox
 for instructions." sentence.

 All together, this means that a fatal error that occurs on a protected
 endpoint before {{{wp_recovery_mode()->initialize()}}} is called — be it
 from core or an MU plugin — will trigger an error screen telling the user
 to look for an email that will never be sent.

 It seems like there are two possible solutions to this problem:

 1. Initialize recovery mode earlier in the process
 2. Update the conditional within
 {{{WP_Fatal_Error_Handler::display_default_error_template()}}} to only
 mention the email if one has actually been sent.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52560>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list