|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-10-08 07:47 UTC] chx@php.net
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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
> 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.