Make WordPress Core

Opened 7 years ago

Last modified 2 years ago

#47266 new defect (bug)

Template of shutdown handler for fatal errors should not be displayed for CLI scripts

Reported by: iandunn Owned by:
Priority: normal Milestone: Awaiting Review
Component: Site Health Version: 5.2
Severity: normal Keywords: servehappy has-patch
Cc: Focuses:

Description (last modified by ocean90)

When running a CLI script that has a syntax error, the template's raw HTML and CSS are output to the command line.

I don't think that the shutdown handler for fatal errors should be loaded in a CLI context; instead, the default PHP behavior should be used instead.

This should handle the case where the CLI script is being run through WP-CLI, and also older scripts that were built before WP-CLI existed, which just load WP manually (i.e., check 'cli' === php_sapi_name() rather than defined( 'WP_CLI' ) ).

Change History (8)

#1 follow-up: @ocean90
7 years ago

  • Description modified (diff)
  • Keywords servehappy added; site-health removed
  • Summary Site health template should not be displayed for CLI scriptsTemplate of shutdown handler for fatal errors should not be displayed for CLI scripts

An alternative would be to add a wp_die handler for CLI context.

#2 in reply to: ↑ 1 @SergeyBiryukov
7 years ago

Replying to ocean90:

An alternative would be to add a wp_die handler for CLI context.

We have (currently unused) _scalar_wp_die_handler(), which seems like a good fit.

Introduced in [20063], unused since [21818].

#3 @desrosj
7 years ago

  • Keywords needs-patch added

This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.


7 years ago

#5 @spacedmonkey
7 years ago

  • Component AdministrationSite Health

This ticket was mentioned in PR #6337 on WordPress/wordpress-develop by @kkmuffme.


2 years ago
#6

  • Keywords has-patch added; needs-patch removed

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


2 years ago

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


2 years ago

Note: See TracTickets for help on using tickets.