From:             
Operating system: irrelivant
PHP version:      5.3.9
Package:          Unknown/Other Function
Bug Type:         Feature/Change Request
Bug description:Allow 'set_error_handler' to handle NULL

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"

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60738&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60738&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60738&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60738&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60738&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60738&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60738&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60738&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60738&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60738&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60738&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60738&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60738&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60738&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60738&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60738&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60738&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60738&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60738&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60738&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60738&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60738&r=mysqlcfg

Reply via email to