From: doctorrock83 at gmail dot com Operating system: Linux PHP version: 5.2.10 PHP Bug Type: Scripting Engine problem Bug description: call_user_func_array modifies internal object context for custom error handler
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 bug report at http://bugs.php.net/?id=49090&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49090&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49090&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49090&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49090&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49090&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49090&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49090&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49090&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49090&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49090&r=support Expected behavior: http://bugs.php.net/fix.php?id=49090&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49090&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49090&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49090&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49090&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49090&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49090&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49090&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49090&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49090&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49090&r=mysqlcfg