|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2024-06-18 09:25 UTC] henry652mike at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 22:00:01 2025 UTC |
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