[wp-trac] [WordPress Trac] #56848: Avoid initializing WP_Recovery_Mode when fatal error handler is disabled

WordPress Trac noreply at wordpress.org
Tue Oct 18 21:33:20 UTC 2022


#56848: Avoid initializing WP_Recovery_Mode when fatal error handler is disabled
-------------------------+------------------------------------------
 Reporter:  flixos90     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.2
Component:  Site Health  |    Version:
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests
  Focuses:               |
-------------------------+------------------------------------------
 #44458 and #46130 introduced the fatal error handler that sends an email
 to the admin to enter a recovery mode.

 Since the initial implementation, there have been a constant
 `WP_DISABLE_FATAL_ERROR_HANDLER` and a filter
 `wp_fatal_error_handler_enabled` which can be used to disable the fatal
 error handler.

 However, as of today the recovery mode logic in the `WP_Recovery_Mode` is
 still being initialized even when the fatal error handler is disabled.
 This does not raise any functional concerns, but it should not be
 necessary given the fatal error handler that can trigger recovery mode is
 disabled. By removing it, we avoid running unnecessary logic and an early
 lookup of the "cron" database option.

 We should amend the clause in `wp-settings.php` around the call that
 initializes the `WP_Recovery_Mode` class with an extra condition for
 `wp_is_fatal_error_handler_enabled()`.

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


More information about the wp-trac mailing list