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

 ID:                 53195
 Updated by:         fel...@php.net
 Reported by:        dmgx dot michael at gmail dot com
 Summary:            __invoke fails when object is member of another
                     object.
-Status:             Open
+Status:             Bogus
 Type:               Bug
-Package:            Class/Object related
+Package:            Scripting Engine problem
 Operating System:   Windows
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

This is the expected behavior. And it is not exclusively related to
parent object... But all $this->closure.



See http://wiki.php.net/rfc/closures/object-extension


Previous Comments:
------------------------------------------------------------------------
[2010-10-28 21:23:39] dmgx dot michael at gmail dot com

Description:
------------
The magic invoke function fails to trigger if an object belongs to
another object.

Test script:
---------------
class A {

        public function __invoke() {

                echo 'hello from A ';

        }

}



class B {

        protected $a;   

        public function __invoke() {

                echo 'hello from B ';

                $this->a = new A();

                $this->a();

        }

}



$b = new B();

$b();

Expected result:
----------------
hello from B hello from A

Actual result:
--------------
hello from B

Fatal error: Call to undefined method B::a() in
C:\xampp\gazelle\tools\htdocs\testing.php on line 15


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



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

Reply via email to