#56848 closed enhancement (fixed)
Avoid initializing WP_Recovery_Mode when fatal error handler is disabled
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 5.2 |
Component: | Site Health | Keywords: | has-patch reporter-feedback |
Focuses: | Cc: |
Description
#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()
.
Change History (10)
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
2 years ago
This ticket was mentioned in PR #3898 on WordPress/wordpress-develop by @costdev.
2 years ago
#3
- Keywords has-patch added; needs-patch removed
This PR adds a wp_is_fatal_error_handler_enabled()
condition before initializing recovery mode.
Trac ticket: https://core.trac.wordpress.org/ticket/56848
#4
@
2 years ago
- Keywords reporter-feedback added
@flixos90 I've submitted PR 3898 which adds wp_is_fatal_error_handler_enabled()
to the conditions before initializing recovery mode.
Regarding needs-unit-tests
, as this change is in wp-settings.php
, which is loaded in the test suite's bootstrap, I'm not sure whether PHPUnit tests are possible for this. What do you think?
#5
@
2 years ago
- Version set to 5.2
Original condition block introduced in [44973]. Setting Version
to 5.2
.
#6
@
2 years ago
Thanks @costdev for the patch. I agree with you that unfortunately we can't reasonably write tests for this. I think this is good to go as is.
@flixos90 commented on PR #3898:
2 years ago
#10
Committed in https://core.trac.wordpress.org/changeset/55143.
This ticket was discussed in the recent bug scrub.
Need a patch for it to help it move forward.
Props to @costdev