php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54069 Improve parser about affecting a closure by reference
Submitted: 2011-02-22 11:03 UTC Modified: 2013-11-03 13:58 UTC
From: jpauli@php.net Assigned:
Status: Wont fix Package: Unknown/Other Function
PHP Version: 5.3.5 OS: *nix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
37 - 14 = ?
Subscribe to this entry?

 
 [2011-02-22 11:03 UTC] jpauli@php.net
Description:
------------
When affecting a closure by reference, the parser doesn't recognize the pattern and issues a parse error.

It could be better to explicitly notice the error

Test script:
---------------
$a = &function () { };

Expected result:
----------------
Some kind of "Warning, Closure cannot be assigned by reference"

Actual result:
--------------
Parse error: syntax error, unexpected T_FUNCTION

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-03 13:58 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2013-11-03 13:58 UTC] nikic@php.net
Assigning a closure by reference makes about as much sense as writing $a = &"foo" (namely: none).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 04:01:30 2024 UTC