cron-command icon indicating copy to clipboard operation
cron-command copied to clipboard

When running cron event produces a fatal error, the shutdown function doesn't run

Open jakubmikita opened this issue 4 years ago • 3 comments

Bug Report

Describe the current, buggy behavior

While running a regular cron command:

wp cron event run --due-now

once the event produces a fatal error, the shutdown action and custom register_shutdown_function isn't called.

Describe how other contributors can replicate this bug

  1. Register an example cron event.
  2. Use callback
add_action( 'example', function() {
	undef_function_9j8yf8me();
} );
  1. Watch for log file
register_shutdown_function( function() {
	file_put_contents( dirname( __FILE__ ) . '/log.log', print_r( 'Shutdown called correctly', true ) . "\r\n\r\n", FILE_APPEND );
} );
  1. Run event - the log is not saved.
  2. Comment the call to undefined function in the event callback.
  3. Run event - the log is saved.

Describe what you would expect as the correct outcome

The shutdown function, thus shutdown action executing with fatal errors.

jakubmikita avatar Feb 04 '21 18:02 jakubmikita

I'll be looking at this today, during Contributor Day.

justinmaurerdotdev avatar Sep 17 '24 17:09 justinmaurerdotdev

Per my PR at https://github.com/wp-cli/cron-command/pull/108, I believe this issue is not valid and can be closed as such.

justinmaurerdotdev avatar Sep 17 '24 23:09 justinmaurerdotdev

@jakubmikita Are you still experiencing this issue? Can you take a look at the tests in #108 and confirm whether they accurately represent the issue you saw?

Thanks!

johnbillion avatar Sep 17 '24 23:09 johnbillion