Edit report at https://bugs.php.net/bug.php?id=62386&edit=1
ID: 62386
User updated by: Daniel dot L dot Nill at gmail dot com
Reported by: Daniel dot L dot Nill at gmail dot com
Summary: Closures require arguments in function header
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: linux
PHP Version: 5.3Git-2012-06-21 (Git)
Block user comment: N
Private report: N
New Comment:
not sure why closures don't allow variable functions, but it turns out my core
issue was a versioning issue. Upon updating php to 5.3.8 this goes away.
Still
not sure why I was getting a parse error when no arguments where introduced,
but
I'm closing this ticket.
Previous Comments:
------------------------------------------------------------------------
[2012-06-22 02:16:06] reeze dot xia at gmail dot com
It's a function but not a class.
We have to use ()to call it
------------------------------------------------------------------------
[2012-06-22 00:35:10] Daniel dot L dot Nill at gmail dot com
Description:
------------
There seems to be no reason for this throwing an error, but if I try to
instantiate an anonymous function that does not have any arguments then I get
an
'Parse error'. This breaks a lot of closure functionality that could exist.
Test script:
---------------
$anonymous_function = function(){
echo "hello world<br/>";
};
$anonymous_function();
$anonymous_function;
Expected result:
----------------
hello world
hello world
Actual result:
--------------
Parse error: syntax error, unexpected T_FUNCTION in /index.php(192) : eval()'d
code on line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62386&edit=1