ID:               49090
 Updated by:       j...@php.net
 Reported By:      doctorrock83 at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.2.10
 New Comment:

That's quite expected output. What exactly are you saying the bug is?


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to