Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > alt.comp.programming > #3193

set_error_handler(): duplicate error

From alex <1j9448a02@lnx159sneakemail.com.invalid>
Newsgroups alt.comp.programming
Subject set_error_handler(): duplicate error
Date 2021-06-10 11:05 +0200
Organization Aioe.org NNTP Server
Message-ID <s9skka$42b$3@gioia.aioe.org> (permalink)

Show all headers | View raw


<?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?

Back to alt.comp.programming | Previous | Next | Find similar


Thread

set_error_handler(): duplicate error alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-10 11:05 +0200

csiph-web