Skip to content

7.2.0

Choose a tag to compare

@misha-rollun misha-rollun released this 30 Oct 20:46
· 56 commits to 7.x since this release

Catch PHP errors and log it in Process and ProcessByName interrupters.

set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) use ($logger) : void {
    if (! (error_reporting() & $errno)) {
        // error_reporting does not include this error
        return;
    }

    $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);

    // Maybe in next releases we will throw this exceptions
    $logger->error('When execute process, catch PHP error. But not throwing it.', [
        'exception' => $exception
    ]);
});