Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

set_error_handler(): duplicate error

2 views
Skip to first unread message

alex

unread,
Jun 10, 2021, 5:05:15 AM6/10/21
to
<?php
//error_reporting(0);
set_error_handler(
static function (int $severity, string $message, string $file, int
$line): void {
throw new InternalErrorException($message, 0, $severity, $file,
$line);
}
);

xxx();

Output:

Fatal error: Uncaught Error: Call to undefined function xxx() in
/tmp/tmp.Ie1UVhkWcT/test.php on line 9

Error: Call to undefined function xxx() in /tmp/tmp.Ie1UVhkWcT/test.php
on line 9

Call Stack:
0.0001 392928 1. {main}() /tmp/tmp.Ie1UVhkWcT/test.php:0

Why error message showing is duplicate?
Furthermore, if uncommenting the error_reporting(0) instruction does not
show any errors.
Is there a good compromise?
0 new messages