#48948 [NEW]: Private/Protected method errors called via call_user_func_array are ambigious

From: Date: Thu, 16 Jul 2009 20:15:16 +0000
Subject: #48948 [NEW]: Private/Protected method errors called via call_user_func_array are ambigious
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2501@lists.php.net to get a copy of this message
From: bigdan at gmail dot com Operating system: linux PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Private/Protected method errors called via call_user_func_array are ambigious Description: ------------ If you call an instantiated object's private/protected method's via call_user_func_array(array($objFoo, 'bar'), $arrParams) the error message regarding why the method is not callable is too generic. It implies the function does not exist. Please note: This is NOT a bug in the code, but rather a error message that could definitely be more helpful, which is why it's filed under documentation. Reproduce code: --------------- <?php class A { private function Foo() { return 'Foo!'; } } $objA = new A(); call_user_func_array(array($objA, 'Foo'), array()); ?> Expected result: ---------------- Fatal error: Call to private method A::Foo() from context '' in on line 10 Actual result: -------------- Warning: call_user_func_array(): First argument is expected to be a valid callback, 'A::Foo' was given in on line 10 -- Edit bug report at http://bugs.php.net/?id=48948&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48948&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48948&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48948&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48948&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48948&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48948&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48948&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48948&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48948&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48948&r=support Expected behavior: http://bugs.php.net/fix.php?id=48948&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48948&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48948&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48948&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48948&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48948&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48948&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48948&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48948&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48948&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48948&r=mysqlcfg

« previous php.doc.bugs (#2501) next »