php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34678 __call(), is_callable() and static methods
Submitted: 2005-09-29 11:57 UTC Modified: 2005-10-03 11:17 UTC
From: bmansion at mamasam dot com Assigned: dmitry (profile)
Status: Closed Package: Class/Object related
PHP Version: 5CVS-2005-10-01 OS: *
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: bmansion at mamasam dot com
New email:
PHP Version: OS:

 

 [2005-09-29 11:57 UTC] bmansion at mamasam dot com
Description:
------------
I think is_callable() should check for existing methods instead of returning true all the time when the class uses overloading. Otherwise it becomes useless.

This is IMO particularly true for static methods checks, since __call is defined as non-static.



Reproduce code:
---------------
class A {
	public function __call($m, $a) {
	
	}
}

class B extends A {
	public static function foo() {
		echo 'foo';
	}
}

if (is_callable(array('A', 'foo'))) {
	call_user_func(array('A', 'foo'));
}

Expected result:
----------------
Outputs nothing.


Actual result:
--------------
Fatal error: Call to undefined method A::foo()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-29 13:14 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-10-01 17:48 UTC] bmansion at mamasam dot com
Same problem with the snapshot.
 [2005-10-02 00:03 UTC] sniper@php.net
Dmitry, check this out.
 [2005-10-03 11:17 UTC] dmitry@php.net
Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 15 20:01:25 2020 UTC