Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#46069 closed defect (bug) (fixed)

WP_CONTENT_DIR in wp_register_fatal_error_handler

Reported by: sebastianpisula's profile sebastian.pisula Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.1
Component: Bootstrap/Load Keywords: has-patch
Focuses: Cc:


I think this is a problem. My case:

I created file fatal-error-handler.php in wp-content directory. In the file I put the code:


class IC_Fatal_Error_Handler extends WP_Fatal_Error_Handler {
        public function handle() {
                wp_die( 'error' );

return new IC_Fatal_Error_Handler();

And nothing. The file isn't loaded. I think that wp_register_fatal_error_handler() should be call after calling wp_initial_constants()

Attachments (1)

46069.patch (1.1 KB) - added by sebastian.pisula 5 years ago.

Download all attachments as: .zip

Change History (7)

#2 @pento
5 years ago

  • Milestone changed from Awaiting Review to 5.2

#3 @diddledani
5 years ago

The conditional check in wp-includes/error-protection.php will always fail so the drop-in file will never be loaded. It checks for defined( 'WP_CONTENT_DIR' ) which will always be false unless the site owner has explicitly set it in wp-config.php. This is because the default definition of this constant is later in the lifecycle.

This ticket was mentioned in Slack in #core by diddledan. View the logs.

5 years ago

#5 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45056:

Bootstrap/Load: Ensure the fatal error handler is registered after WP_CONTENT_DIR is defined, so the custom error handler drop-in could be properly loaded.

Props sebastian.pisula, diddledan.
Fixes #46069.

#6 @SergeyBiryukov
5 years ago

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