Req #54069 [Opn->Wfx]: Improve parser about affecting a closure by reference

From: Date: Sun, 03 Nov 2013 13:58:31 +0000
Subject: Req #54069 [Opn->Wfx]: Improve parser about affecting a closure by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182576@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54069&edit=1 ID: 54069 Updated by: nikic@php.net Reported by: jpauli@php.net Summary: Improve parser about affecting a closure by reference -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Unknown/Other Function Operating System: *nix PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Assigning a closure by reference makes about as much sense as writing $a = &"foo" (namely: none). Previous Comments: ------------------------------------------------------------------------ [2011-02-22 11:03:38] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54069&edit=1

« previous php.bugs (#182576) next »