|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-18 14:12 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 00:00:02 2025 UTC |
Description: ------------ __invoke in child class not worked correctly? Reproduce code: --------------- class Callable { function __invoke($x) { var_dump($x); } } class A {} $obj = new Callable; $a = new A; $a->c = $obj; var_dump(is_callable($obj)); var_dump(is_callable($a->c)); $obj(1); $a->c(2); Expected result: ---------------- bool(true) bool(true) int(1) int(2) Actual result: -------------- bool(true) bool(true) int(1) Fatal error: Call to undefined method A::c() in E:\Work\1.php on line 22 PHP Fatal error: Call to undefined method A::c() in E:\Work\1.php on line 22