ID:               47665
 Updated by:       fel...@php.net
 Reported By:      al dot james at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Mac OS 10.5
 PHP Version:      5.3.0beta1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




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

[2009-03-15 19:22:46] al dot james at gmail dot com

Description:
------------
If I assign an instance of the Closure object as a property of an 
object, I would expect to be able to execute that property as a 
function.

E.g.

$o = new stdClass;

$o->test = function(){
        echo "Executing function";      
};

I would expect this to work:

$o->test();

However, it does not. This does:

call_user_func($o->test);

The $o->test() syntax is more concise and in keeping with other 
languages with such features.

Reproduce code:
---------------
$o = new stdClass;

$o->test = function(){
        echo "Executing function";      
};

$o->test();

Expected result:
----------------
Executing function

Actual result:
--------------
PHP Fatal error:  Call to undefined method stdClass::test()


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


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

Reply via email to