php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #18016 function_exists, call_user_func_* and methods
Submitted: 2002-06-27 08:08 UTC Modified: 2002-07-01 18:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: akul at otamedia dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.2.1 OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: akul at otamedia dot com
New email:
PHP Version: OS:

 

 [2002-06-27 08:08 UTC] akul at otamedia dot 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.)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-27 08:15 UTC] mfischer@php.net
The syntax for calling static class methods is

  array('classname', 'methodname');

Reclassiyfing as documentation problem.
 [2002-06-27 09:13 UTC] akul at otamedia dot com
Thanks! But how about function_exists()?

function_exists(array("test","staticFunction"))

 doesn't work.
 [2002-07-01 18:24 UTC] jan@php.net
why should function_exists() check for a static method if there is method_exists()
 [2002-07-01 18:24 UTC] jan@php.net
why should function_exists() check for a static method if there is method_exists()
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 07:01:33 2025 UTC