WordPress.org

Make WordPress Core

Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#46620 closed enhancement (fixed)

WSoD Protection: Pass the error through to error template and associated filters

Reported by: johnbillion Owned by: SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.2
Component: Plugins Keywords: has-patch
Focuses: Cc:

Description

This change passes the error data through the error template handler, so it's exposed to the custom error handler if present, and through the default error template handler, so it's exposed to the default error message filters and the ultimate WP_Error object that's passed to wp_die().

This has a few benefits:

  • The custom error handler and default error message filters can inspect the error and perform logic based on its properties.
  • Custom wp_die() handlers can alter their behaviour depending on a combination of the error itself and the WP_Error code. For example, WP-CLI could more gracefully handle this error in its output by including details of the error itself and information about enabling recovery mode or using WP-CLI's own --skip-plugins flag.

Taken from https://github.com/wp-core-php/wordpress-develop/pull/7

Attachments (1)

46620.diff (2.8 KB) - added by johnbillion 21 months ago.

Download all attachments as: .zip

Change History (4)

@johnbillion
21 months ago

#1 @johnbillion
21 months ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
20 months ago

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

In 45023:

Bootstrap/Load: In fatal error handler, pass the error information through to error template and associated filters: wp_php_error_message, wp_php_error_args.

This allows the custom error handler and default error message filters to inspect the error and perform logic based on its properties.

Props johnbillion.
Fixes #46620.

#3 @SergeyBiryukov
20 months ago

In 45025:

PHPCS: Fix WPCS violations in [45023].

See #46620.

Note: See TracTickets for help on using tickets.