Cannot use invoke magic method within another object

marat

New Member
I have experienced something that I think it's a bug, but I'm not sure. So I come here to ask to the people who know more about this than me, is this a PHP bug? Look at the following lines:\[code\]<h1>Tests</h1><?phpclass Foo { public function __invoke() { return 'Called correctly'; } }class Boo { public function __construct() { $this->Foo = new Foo(); } }$Foo = new Foo();echo $Foo();echo "<br><br><hr><br><br>";$Boo = new Boo();echo $Boo->Foo();\[/code\]According to the specification, since \[code\]The __invoke() method is called when a script tries to call an object as a function\[/code\], I should obtain this:\[quote\] Called correctly Called correctly\[/quote\]But the last echo is not executed. Instead, I get this:\[quote\] PHP Fatal error: Call to undefined method Boo::Foo() in [...]/index.php on line 26\[/quote\]Is this a bug or an expected behaviour? If it's a bug, some help about how to submit it would be highly appreciated.
 
Top