Bug #68182 [Com]: array("foo", "bar")() is invalid syntax
| From: | nazi dot farhadi3171 at gmail dot com | Date: | Thu, 15 Dec 2022 05:52:54 +0000 |
| Subject: | Bug #68182 [Com]: array("foo", "bar")() is invalid syntax | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-243145@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68182&edit=1
ID: 68182
Comment by: nazi dot farhadi3171 at gmail dot com
Reported by: chx@php.net
Summary: array("foo", "bar")() is invalid syntax
Status: Open
Type: Bug
Package: PHP Language Specification
PHP Version: PHP-5.6
Block user comment: N
Private report: N
New Comment:
ok for the info i will try to figure it out for more
(https://www.pointclickcarecna.net/)github.com
Previous Comments:
------------------------------------------------------------------------
[2016-11-11 21:55:59] nikic@php.net
function-call-expression now has a callable-expression as the LHS, which should accurate represent
what is (syntactically) allowed on the LHS.
However, this does not resolve the inaccuracy wrt array *values*.
------------------------------------------------------------------------
[2014-10-08 19:07:09] requinix@php.net
Yeah, the constraints doesn't mention that arrays are allowed. And
> postfix-expression must designate a function... by being a value of type
> string (but not a string literal) that contains the function's name
UVS allows literals http://3v4l.org/V6tTG
Side note: the sentence immediately after
> The number of arguments present in a function call must be at least as many
> as the number of parameters defined for that function.
should clarify that it's the number of *required* parameters.
Then at the end of the Semantics section,
> If postfix-expression is a string, this is a variable function call
which links to 13-functions.md#variable-functions that says
> If a variable name is followed by the function-call operator () (§§), and
> the value of that variable is a string containing the name of a function
> currently defined and visible, that function will be executed.
which also doesn't include arrays.
------------------------------------------------------------------------
[2014-10-08 17:24:14] ajf@php.net
In that case, we should change this is master to reflect it being accepted by PHP7's Uniform
Variable Syntax.
------------------------------------------------------------------------
[2014-10-08 14:54:08] cmbecker69 at gmx dot de
> According to the specs, any postfix expression + argument list
> is a valid function call.
No. While it is syntatically valid, there are further constraints:
| postfix-expression must designate a function, either by being
| its name, by being a value of type string (but not a string
| literal) that contains the function's name, or by being a variable
| whose type is Closure (§§) or a derived type thereof.
array("foo", "bar") doesn't fulfill these constraints.
------------------------------------------------------------------------
[2014-10-08 08:06:06] requinix@php.net
Actually it is valid syntax but you need the uniform variable syntax changes in PHP 7 to get it.
http://3v4l.org/TbcgJ
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=68182
--
Edit this bug report at https://bugs.php.net/bug.php?id=68182&edit=1