From: [EMAIL PROTECTED]
Operating system: Windows XP (Build 2600)
PHP version: 5.2.5
PHP Bug Type: Feature/Change Request
Bug description: set_error_handler is not being used on undefined functions
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 bug report at http://bugs.php.net/?id=44192&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44192&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44192&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44192&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44192&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44192&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44192&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44192&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44192&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44192&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44192&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44192&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44192&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44192&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44192&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44192&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44192&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44192&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44192&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44192&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44192&r=mysqlcfg