Hi,
Started using 5.3 and stumbled into what appears to be a bug with the
__invoke() magic method. It works fine if used in an object for a class
defining __invoke() is stored in a local variable, however when storing said
object as an instance variable, a fatal is raised. See my example below.
<?php
class A
{
public function __invoke()
{
echo __CLASS__ . PHP_EOL;
}
}
class B
{
private $a = null;
public function __construct()
{
$this->a = new A();
$this->a();
}
}
$a = new A();
$a();
$b = new B();
?>
Output:
A
Fatal error: Call to undefined method B::a() in
/Users/quickshiftin/gitRepos/timberline/ct-rip/test-callable.php on line 17
Expected Output:
A
A
thx,
-nathan