lavary/crunz

set_exception_handler() inside event closure is ignored

Opened this issue · 0 comments

Crunz version: 3.0.1

PHP version: 7.4.24

Operating system type and version: Ubuntu

Description
set_exception_handler() inside event closures isn't called.

We set up a global error handler (Sentry) and missed uncaught exceptions, as we weren't looking at the logs.

set_error_handler works just fine.

How to reproduce

<?php

$sch = new Crunz\Schedule();

$sch->run(function () {
	set_exception_handler(static function (Throwable $e) {
		// report $e
	});
	
	throw new Exception('Uh-Oh SpaghettiOs');
})
	->name("Where are teh errors?")
	->everyMinute()
;

return $sch;

Additional context
This is not due to the Opis Closure serialization.

Does crunz closure:run set up its own exception handler?