ID: 49090 Updated by: j...@php.net Reported By: doctorrock83 at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.2.10 New Comment:
Try doing 'var_dump()' on the call to set_error_handler() and you'll see it returns NULL which means it never registered your invalid error handler callback. Previous Comments: ------------------------------------------------------------------------ [2009-07-29 07:29:28] doctorrock83 at gmail dot com setting the error handler works, however it doesn't get called) ------------------------------------------------------------------------ [2009-07-28 19:18:06] j...@php.net Setting the error handler fails, so why should it be used..? ------------------------------------------------------------------------ [2009-07-28 19:02:27] doctorrock83 at gmail dot com Well call_user_func_array() actually generates an error which is not trapped in the custom error handler as it should be) ------------------------------------------------------------------------ [2009-07-28 18:29:02] j...@php.net That's quite expected output. What exactly are you saying the bug is? ------------------------------------------------------------------------ [2009-07-28 17:30:21] doctorrock83 at gmail dot com Description: ------------ call_user_func_array() seems to modifies the internal object context while used with set_error_handler(); See the reproduce code. Note: In the reproduce code, when not using call_user_func_array() (direct function call), there is no problem and the expected behavior occurs. Reproduce code: --------------- <?php class Foo { public function call() { set_error_handler(array($this, '_errors')); $result = call_user_func_array('ucfirst', array()); } protected function _errors($errno, $errstr) { throw new Exception($errstr); } } $f = new Foo; $f->call(); Expected result: ---------------- Exception thrown with the message telling that ucfirst accept one parameter, none given Actual result: -------------- Fatal error: Call to protected method Foo::_errors() from context '' in /path/to/script.php on line XXX PHP 5.3.0 returns : Warning: Invalid callback Foo::_errors, cannot access protected method Foo::_errors() in /path/to/script.php on line XXX Warning: ucfirst() expects exactly 1 parameter, 0 given in /path/to/script.php on line XXX ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49090&edit=1