set_error_handler(): duplicate error
alex <[email protected]> Thu, 10 Jun 2021 11:05:14 +0200
| Newsgroups | alt.comp.programming |
|---|---|
| Organization | Aioe.org NNTP Server |
| Message-ID | <[email protected]> |
<?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?