Allow 'set_error_handler' to handle NULL
| Request #60738 | Allow 'set_error_handler' to handle NULL | ||||
|---|---|---|---|---|---|
| Submitted: | 2012-01-13 02:22 UTC | Modified: | 2012-09-28 04:09 UTC | ||
| From: | four dot zerooneunauthorized at gmail dot com | Assigned: | laruence (profile) | ||
| Status: | Closed | Package: | Unknown/Other Function | ||
| PHP Version: | 5.3.9 | OS: | irrelivant | ||
| Private report: | No | CVE-ID: | None | ||
[2012-01-13 02:22 UTC] four dot zerooneunauthorized at gmail dot com
Description:
------------
Can the 'set_error_handler' function be made to accept NULL as the parameter in such a way as to reset this feature to the default state of -no- handler being set? This would duplicate the behavior of the 'set_exception_handler' function.
Note: this change should not interfere with the 'restore_error_handler' function.
And as for the 'set_exception_handler' function - if NULL is given as a parameter, can the return value of 'set_exception_handler' be set to the details of the previously set exception handler function (string or array) instead of always '(bool) true' as it now does?
Test script:
---------------
function testhandler1($errno= null, $errstr= null, $errfile= null, $errline = null)
{
error_log('1: ' . print_r(func_get_args(), true));
die();
}
function testhandler2($errno= null, $errstr= null, $errfile= null, $errline = null)
{
error_log('2: ' . print_r(func_get_args(), true));
die();
}
var_dump(set_error_handler('testhandler1'));
var_dump(set_error_handler('testhandler2'));
var_dump(set_error_handler(null));
Expected result:
----------------
NULL
string(12) "testhandler1"
string(12) "testhandler2"
Actual result:
--------------
On line 'var_dump(set_error_handler(null));', a 'set_error_handler() expects the argument () to be a valid callback' error is generated and handled by function "testhandler2"
Patches
bug60738.patch (last revision 2012-03-24 04:17 UTC by laruence@php.net)error_handler_patch_1.diff (last revision 2012-03-23 20:50 UTC by nikic@php.net)
set_error_handler-allow-null-parameter-corrected (last revision 2012-03-11 07:46 UTC by kevin dot swinton at gmail dot com)
set_error_handler-allow-null-parameter (last revision 2012-03-10 22:34 UTC by kevin dot swinton at gmail dot com)
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2012-03-13 08:56 UTC] kevin dot swinton at gmail dot com
[2012-03-24 03:26 UTC] laruence@php.net
[2012-03-24 08:52 UTC] stas@php.net
[2012-03-24 08:52 UTC] stas@php.net
-Status: Closed +Status: Re-Opened
[2012-03-24 10:00 UTC] laruence@php.net
[2012-03-24 11:44 UTC] laruence@php.net
[2012-09-28 04:09 UTC] laruence@php.net