Bug #68182 [Opn->Nab]: array("foo", "bar")() is invalid syntax

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=68182&edit=1

 ID:                 68182
 Updated by:         [email protected]
 Reported by:        [email protected]
 Summary:            array("foo", "bar")() is invalid syntax
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            PHP Language Specification
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Actually it is valid syntax but you need the uniform variable syntax changes in PHP 7 to get it.
http://3v4l.org/TbcgJ


Previous Comments:
------------------------------------------------------------------------
[2014-10-08 07:47:11] [email protected]

Description:
------------
According to the specs, https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#function-call-operator any postfix expression + argument list is a valid function call. 

Looking at postfix expressions https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#general-3 it says array-creation-expression is a postfix expression.


Test script:
---------------
array("foo", "bar")();

Expected result:
----------------
PHP Fatal error:  Class 'foo' not found in Command line code on line 1


Actual result:
--------------
PHP Parse error:  syntax error, unexpected '(' in Command line code on line 1



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68182&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.