Skip to content

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

Closed
@jakubmikita

Description

@jakubmikita

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions