Edit report at http://bugs.php.net/bug.php?id=51326&edit=1
ID: 51326 Updated by: [email protected] Reported by: frederic dot hardy at mageekbox dot net Summary: Closure must be used as object property -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: FreeBSD 7.1 PHP Version: 5.3.2 New Comment: The whole "object handling" of closures was held back in order to get 5.3out. The next major version of PHP (5.4 / 6.0) will most likely add better oo support. During the discussions this aspect will be discussed,no need for an additional bug report. Previous Comments: ------------------------------------------------------------------------ [2010-03-18 21:21:07] frederic dot hardy at mageekbox dot net Description: ------------ If a class instance has a closure as property, PHP must call $this->closure->__invoke() instead of say that method class::closure() does not exist. Test script: --------------- <?php class foo { protected $closure = null; function __construct(\closure $closure) { $this->closure = $closure; } function callClosure() { return $this->closure('Closure::__invoke() was called'); } } $foo = new foo(function($string) { echo $string; }); $foo->callClosure(); ?> Expected result: ---------------- Closure::__invoke() was called Actual result: -------------- Call to undefined method foo::closure() in /path/to/script.php on line 14 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51326&edit=1
