#47299 [Com]: static lambda function now give parse error
| From: | ninzya at inbox dot lv | Date: | Wed, 04 Feb 2009 15:33:44 +0000 |
| Subject: | #47299 [Com]: static lambda function now give parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133486@lists.php.net to get a copy of this message | ||
ID: 47299
Comment by: ninzya at inbox dot lv
Reported By: nospam at example dot com
Status: Open
Bug Type: Compile Failure
Operating System: Windows XP SP3
PHP Version: 5.3.0beta1
New Comment:
This functionality has been temporarily dropped from PHP 5.3. Read
http://news.php.net/php.internals/42876 for
details.
Previous Comments:
------------------------------------------------------------------------
[2009-02-04 10:18:26] nospam at example dot com
Expected result is for it to work.
The parse error is the problem.
------------------------------------------------------------------------
[2009-02-04 10:17:14] nospam at example dot com
Description:
------------
The latest 5.3.0beta1 has broken static lambda functions.
Previously this worked on 5.3.0alpha3.
The example below is taken from: http://wiki.php.net/rfc/closures
The rfc page recommends using static to reduce memory overhead.
Reproduce code:
---------------
class Example {
public function doSomething () {
$x = 4;
$closure = static function ($y) use ($x) {
return $x + $y;
};
return $closure (6);
}
}
Expected result:
----------------
Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47299&edit=1