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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 17:01:31 2024 UTC