From:             jon at fuck dot org
Operating system: gnu/linux, 2.6.14-1.1637_FC4
PHP version:      5.1.1
PHP Bug Type:     Feature/Change Request
Bug description:  first call to set_error_handler returns same value on success 
and error

Description:
------------
the first call to set_error_handler returns NULL on success. on failure,
e.g., if the desired callback function has not been declared, an E_WARNING
is thrown and NULL is returned. this makes checking for failure of this
function a little kludgy.

it would be better to always return FALSE on error, or, return the name of
the internal PHP error handler on success, which is what our custom error
handlers will be replacing on the first call.

by looking at previous bugs about this, it seems as though the
documentation was right and the code was wrong.

Reproduce code:
---------------
<?
function foo() { echo 'foo'; }
echo (NULL === set_error_handler('foo'));
echo (NULL === set_error_handler('bar'));
?>

Expected result:
----------------
1foo

Actual result:
--------------
1foo1

-- 
Edit bug report at http://bugs.php.net/?id=35963&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35963&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35963&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35963&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35963&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35963&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35963&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35963&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35963&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35963&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35963&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35963&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35963&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35963&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35963&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35963&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35963&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35963&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35963&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35963&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35963&r=mysqlcfg

Reply via email to