|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67620 is_callable and self
Submitted: 2014-07-15 08:35 UTC Modified: 2016-01-15 13:08 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: remyfox at hotmail dot com Assigned: danack (profile)
Status: Assigned Package: Unknown/Other Function
PHP Version: 5.4Git-2014-07-15 (Git) OS: windows 7
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.
Block user comment
Status: Assign to:
Bug Type:
From: remyfox at hotmail dot com
New email:
PHP Version: OS:


 [2014-07-15 08:35 UTC] remyfox at hotmail dot com
PHP 5.4.7

When "self" is provided to is_callable, while inside a class that doesn't contain the method nor has a parent with the method, it will behave as $this.

Subsequent calling of the method which had been falsely declared callable, will result in 

Fatal error: Call to undefined method A::y() in *__FILE__* on line 5

Test script:
	class A {
		public function x() {
			if (is_callable(array($this, "y"))) $this::y();
			if (is_callable(array("self", "y"))) self::y();
	class B extends A {
		public function y() {}
	(new B())->x();

Expected result:
Self should behalve like __CLASS__ in the example above and the fatal error should be avoided.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-15 13:08 UTC]
-Assigned To: +Assigned To: danack
 [2016-01-15 13:08 UTC]
Assigning to myself. This will require an RFC to change.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jul 29 13:01:23 2021 UTC