Req #44192 [Opn->Csd]: set_error_handler is not being used on undefined functions

From: Date: Mon, 23 Jan 2017 13:48:52 +0000
Subject: Req #44192 [Opn->Csd]: set_error_handler is not being used on undefined functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206889@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=44192&edit=1 ID: 44192 Updated by: nikic@php.net Reported by: kalle@php.net Summary: set_error_handler is not being used on undefined functions -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Windows XP (Build 2600) PHP Version: 5.2.5 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2017-01-23 13:26:52] narf at devilix dot net As of PHP 7, an Error exception is thrown and then caught by set_exception_handler() callbacks. ------------------------------------------------------------------------ [2008-02-20 20:49:32] kalle@php.net Description: ------------ When setting your own custom error handler and then calling an undefined function then the error handler isn't triggered. I read on the manual that: "If errors occur before the script is executed (e.g. on file uploads) the custom error handler cannot be called since it is not registered at that time." But I would expect undefined function errors to be apart of the execution as a function might be created dynamiclly. I also found bug '#11803' and read that fatal errors aren't passed to custom error handler functions, but It would be nice to be able to fetch such errors in larger applications. Cheers Reproduce code: --------------- <?php function error_handler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL) { var_dump($errno, $errstr, $errfile, $errline); return(true); } set_error_handler('error_handler'); undef_function(); /** Rest of the script */ ?> Expected result: ---------------- int(2) string(28) "Call to undefined function undef_function()" string(29) "/webserver/webroot/test.php" int(11) Actual result: -------------- Fatal error: Call to undefined function undef_function() in /webserver/webroot/test.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=44192&edit=1

« previous php.bugs (#206889) next »