Req #62386 [Com]: Closures require arguments in function header

From: Date: Fri, 22 Jun 2012 02:16:06 +0000
Subject: Req #62386 [Com]: Closures require arguments in function header
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-171423@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62386&edit=1 ID: 62386 Comment by: reeze dot xia at gmail dot com Reported by: Daniel dot L dot Nill at gmail dot com Summary: Closures require arguments in function header Status: Open 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: It's a function but not a class. We have to use ()to call it Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#171423) next »