swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.04k stars 390 forks source link

Replace FatalThrowableError with FatalError #417

Closed netdown closed 4 years ago

netdown commented 4 years ago

Debug component was deprecated and replaced by ErrorHandler in Symfony 4.4. Laravel 7 uses a Symfony 5 which does not contain Debug anymore, therefore app crashes. ErrorHandler does not have a similar class, therefore I extracted a little bit of logic from the old FatalThrowableError to construct a FatalError object. Fixes #406

EDIT: using getCode() on exception may be a better choice, however, it would behave differently than the old class.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.5%) to 68.128% when pulling e9de2aa7c1bba2c344c59de82a6c94b631174b51 on netdown:master into 2271aa7fbd881d932ecca46749a609c36e15cf93 on swooletw:master.

paschaldev commented 4 years ago

Need this

netdown commented 4 years ago

@albertcht Would you be able to merge some of the pull requests and make a release?

serdarozturk commented 4 years ago

Maybe we should check the class existence for coverage issue.

if (class_exists(FatalThrowableError::class)) {
               $e = new FatalThrowableError($e);
} else {
                if ($e instanceof \ParseError) {
                    $severity = E_PARSE;
                } elseif ($e instanceof \TypeError) {
                    $severity = E_RECOVERABLE_ERROR;
                } else {
                    $severity = E_ERROR;
                }
                $error = [
                    'type' => $severity,
                    'message' => $e->getMessage(),
                    'file' => $e->getFile(),
                    'line' => $e->getLine(),
                ];
                $e = new FatalError($e->getMessage(), $e->getCode(), $error, null, true, $e->getTrace());
}
Arkanius commented 4 years ago

@serdarozturk you say it in order to keep compatibility with older versions?

ValeraBot commented 4 years ago

Why it is not in master?

lagerroos commented 3 years ago

@albertcht Has this been removed from master and if so, why would that be?