Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#46069 closed defect (bug) (fixed)

WP_CONTENT_DIR in wp_register_fatal_error_handler

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

Description

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:

<?php

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

Download all attachments as: .zip

Change History (7)

#2 @pento
8 years ago

  • Milestone Awaiting Review → 5.2

#3 @diddledani
8 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.


8 years ago

#5 @SergeyBiryukov
8 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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
8 years ago

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