[wp-trac] [WordPress Trac] #47266: Template of shutdown handler for fatal errors should not be displayed for CLI scripts (was: Site health template should not be displayed for CLI scripts)

WordPress Trac noreply at wordpress.org
Tue May 14 18:22:19 UTC 2019


#47266: Template of shutdown handler for fatal errors should not be displayed for
CLI scripts
----------------------------+------------------------------
 Reporter:  iandunn         |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  5.2
 Severity:  normal          |  Resolution:
 Keywords:  servehappy      |     Focuses:
----------------------------+------------------------------
Changes (by ocean90):

 * keywords:  site-health => servehappy


Old description:

> 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 Site Health feature 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' )` ).

New description:

 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' )` ).

--

Comment:

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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47266#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list