#48581 [Opn->Bgs]: __invoke in child class

From: Date: Thu, 18 Jun 2009 14:12:04 +0000
Subject: #48581 [Opn->Bgs]: __invoke in child class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138460@lists.php.net to get a copy of this message
 ID:               48581
 Updated by:       johannes@php.net
 Reported By:      yeti at na-svyazi dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: winxp
 PHP Version:      5.3CVS-2009-06-17 (snap)
 New Comment:

$a->c(2); looks for a method c in the object, not a property. This is
currently expected behavior. We will consider adding this in later
versions.


Previous Comments:
------------------------------------------------------------------------

[2009-06-17 10:45:35] yeti at na-svyazi dot ru

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



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48581&edit=1



Thread (2 messages)

« previous php.bugs (#138460) next »