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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Sep 16 01:00:01 2025 UTC