From:
Operating system:
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Provide a way to feed error_get_last() from custom error handler
Description:
------------
When you write a custom error handler to be used with set_error_handler(),
the error_get_last() function is no longer usable (always returns NULL)
unless you make your handler return FALSE (the internal variables required
are filled by the builtin error handler).
There should be a mechanism to feed the required error info from custom
error handler so error_get_last() can be made available.
Test script:
---------------
<?php
function custom_error_handler($errno, $errstr, $errfile, $errline){
$ignore = ($errno & error_reporting()) == 0;
if(!$ignore){
echo "[Error happened: $errstr]\n";
}
return TRUE;
}
set_error_handler('custom_error_handler');
@fopen('xxx');
var_dump( error_get_last() ); // NULL
Expected result:
----------------
array(4) {
["type"]=>
int(2)
["message"]=>
string(46) "fopen() expects at least 2 parameters, 1 given"
["file"]=>
string(15) "C:\tmp\test.php"
["line"]=>
int(11)
}
Actual result:
--------------
NULL
--
Edit bug report at https://bugs.php.net/bug.php?id=60575&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60575&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60575&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60575&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60575&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60575&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60575&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60575&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60575&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60575&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60575&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60575&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60575&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60575&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60575&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60575&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60575&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60575&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60575&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60575&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60575&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60575&r=mysqlcfg