Make WordPress Core

Opened 6 years ago

Last modified 7 months ago

#47266 new defect (bug)

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

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

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
6 years ago

  • Description modified (diff)
  • Keywords servehappy added; site-health removed
  • Summary changed from Site health template should not be displayed for CLI scripts to Template 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
6 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
6 years ago

  • Keywords needs-patch added

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


6 years ago

#5 @spacedmonkey
5 years ago

  • Component changed from Administration to Site Health

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


9 months ago
#6

  • Keywords has-patch added; needs-patch removed

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


8 months ago

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


7 months ago

Note: See TracTickets for help on using tickets.