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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jpauli@php.net
New email:
PHP Version: OS:

 

 [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: Fri Apr 19 10:01:28 2024 UTC