Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Enh #163: Explicitly import classes, functions, and constants in "use" section (@mspirkov)
- Bug #164: Fix missing items in stack trace HTML output when handling a PHP error (@vjik)
- Bug #166: Fix broken link to error handling guide (@vjik)
- Chg #170: Make all parameters of `ErrorException` constructor required (@vjik)

## 4.3.2 January 09, 2026

Expand Down
11 changes: 9 additions & 2 deletions src/Exception/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ class ErrorException extends \ErrorException implements FriendlyExceptionInterfa
];

/** @psalm-param DebugBacktraceType $backtrace */
public function __construct(string $message = '', int $code = 0, int $severity = 1, string $filename = __FILE__, int $line = __LINE__, ?Exception $previous = null, private readonly array $backtrace = [])
{
public function __construct(
string $message,
int $code,
int $severity,
string $filename,
int $line,
?Exception $previous,
private readonly array $backtrace,
) {
parent::__construct($message, $code, $severity, $filename, $line, $previous);
$this->addXDebugTraceToFatalIfAvailable();
}
Expand Down
22 changes: 20 additions & 2 deletions tests/Renderer/HtmlRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,15 @@ public function testRenderCallStackWithErrorException(): void
$renderer = new HtmlRenderer();

$result = $renderer->renderCallStack(
new ErrorException('test-message'),
new ErrorException(
'test-message',
0,
0,
__FILE__,
__LINE__,
null,
[],
),
TestHelper::generateTrace([true, true, false, true]),
);

Expand Down Expand Up @@ -455,8 +463,18 @@ public function testRenderCurlForFailRequest(): void

public function testGetThrowableName(): void
{
$exception = new ErrorException(
'test-message',
0,
0,
__FILE__,
__LINE__,
null,
[],
);

$renderer = new HtmlRenderer();
$name = $renderer->getThrowableName(new ErrorException());
$name = $renderer->getThrowableName($exception);

$this->assertSame('Error (' . ErrorException::class . ')', $name);
}
Expand Down
Loading