|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78898 call_user_func(['parent'.. fails while other succeed
Submitted: 2019-12-02 12:49 UTC Modified: 2019-12-04 08:37 UTC
From: Assigned: nikic (profile)
Status: Closed Package: Class/Object related
PHP Version: 7.4.0 OS: archLinux
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:
New email:
PHP Version: OS:


 [2019-12-02 12:49 UTC]
when extending a class that has both a protected method, and a __call - certain call_user_func calls will end up in __call instead of the protected method - see

Test script:

class A
	protected function _x()
		echo "a";

	public function __call($methodName, array $arguments)
		throw new Exception("Unknown method.");

class B extends A
	public function x()
		parent::_x(); # works
		call_user_func('parent::_x'); # works
		call_user_func(['parent', '_x']); # fails

$b = new B;

Expected result:

Actual result:
aa Exception


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-03 09:38 UTC]
The behavioral change has been introduced with commit 72bf2de[1].
Not sure whether this particular change was intented.

[1] <;a=commit;h=72bf2def6b718ae9ca243b6a9ab9a3a85d255f96>
 [2019-12-04 08:37 UTC]
-Assigned To: +Assigned To: nikic
 [2019-12-04 08:42 UTC]
Automatic comment on behalf of
Log: Fixed bug #78898
 [2019-12-04 08:42 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 18:01:30 2024 UTC