|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45001 Provide the ability to use is_callable() with __call()
Submitted: 2008-05-15 00:21 UTC Modified: 2015-01-07 20:53 UTC
Avg. Score:3.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: kristopherwilson at gmail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.2.6 OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
16 - 5 = ?
Subscribe to this entry?

 [2008-05-15 00:21 UTC] kristopherwilson at gmail dot com
It would be useful to be able to use the is_callable() function on an object that overloads with __call(). Perhaps something like a magic __callable() or __is_callable() method that would return true or false on whether or not the method is callable. 

Reproduce code:
	class MyClass
		public function __callable( $sMethod )
			return( is_callable( array( $this, $sMethod ) ) );
		private function MyFunction() {}
	$oMyClass = new MyClass();

	if( is_callable( $oMyClass, "MyFunction" ) )
		echo "Callable!";

Expected result:

Actual result:
[no output]


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-07 20:53 UTC]
-Package: Feature/Change Request +Package: *General Issues
 [2015-01-07 20:53 UTC]
It would be difficult to know what the result of calling `__call` would be. This would need more discussion if people are really interested.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC