Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fatal error gets turned to 0 severity on shutdown handler #6472

Merged
merged 1 commit into from
Sep 2, 2022

Conversation

paulbalandan
Copy link
Member

Description
Fixes #6454

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 2, 2022
@@ -177,7 +177,7 @@ public function shutdownHandler()
['type' => $type, 'message' => $message, 'file' => $file, 'line' => $line] = $error;

if (in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE], true)) {
$this->exceptionHandler(new ErrorException($message, $type, 0, $file, $line));
$this->exceptionHandler(new ErrorException($message, 0, $type, $file, $line));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

public ErrorException::__construct(
    string $message = "",
    int $code = 0,
    int $severity = E_ERROR,
    ?string $filename = null,
    ?int $line = null,
    ?Throwable $previous = null
)

https://www.php.net/manual/en/errorexception.construct.php#refsect1-errorexception.construct-parameters

severity
The severity level of the exception.
Note:
While the severity can be any int value, it is intended that the error constants be used.

@kenjis kenjis merged commit e2606a8 into codeigniter4:develop Sep 2, 2022
@paulbalandan paulbalandan deleted the shutdown-handler branch September 3, 2022 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Shutdown handler diminishes fatal error's severity to a measly value of 0
3 participants