Bug #18016 Updated: function_exists, call_user_func_* and methods

From: Date: Mon, 01 Jul 2002 22:24:04 +0000
Subject: Bug #18016 Updated: function_exists, call_user_func_* and methods
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-12738@lists.php.net to get a copy of this message
ID: 18016 Updated by: jan@php.net Reported By: akul@otamedia.com Status: Open Bug Type: Documentation problem Operating System: all PHP Version: 4.2.1 New Comment: why should function_exists() check for a static method if there is method_exists() Previous Comments: ------------------------------------------------------------------------ [2002-06-27 09:13:28] akul@otamedia.com Thanks! But how about function_exists()? function_exists(array("test","staticFunction")) doesn't work. ------------------------------------------------------------------------ [2002-06-27 08:15:38] mfischer@php.net The syntax for calling static class methods is array('classname', 'methodname'); Reclassiyfing as documentation problem. ------------------------------------------------------------------------ [2002-06-27 08:08:05] akul@otamedia.com <? class test { function staticFunction($a) { echo "\ntest::staticFunction($a)"; } } echo "\nTest page\n"; echo 'function_exists=['.function_exists("test::staticFunction").']'; test::staticFunction(999); call_user_func_array("test::staticFunction",array(999)); ?> Result: Test page function_exists=[] test::staticFunction(999) Warning: call_user_func_array() expects first argument, 'test::staticFunction', to be a valid callback in bug.php on line 17 Must be: Test page function_exists=[TRUE] test::staticFunction(999) test::staticFunction(999) (Please, don't write me stupid comments about method_exists()! Just read one more time function name.) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18016&edit=1

« previous php.bugs (#12738) next »