php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68183 Several postfix expressions are not valid for function call
Submitted: 2014-10-08 08:16 UTC Modified: 2016-11-11 21:57 UTC
From: chx@php.net Assigned: nikic (profile)
Status: Closed Package: PHP Language Specification
PHP Version: PHP-5.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 49 = ?
Subscribe to this entry?

 
 [2014-10-08 08:16 UTC] chx@php.net
Description:
------------
Even in PHP 7

postfix-increment-expression
postfix-decrement-expression
exponentiation-expression

These one produce syntax errors and make no sense especially because exponentation is definitely numeric while function names must start with a letter (or so I thought).

member-selection-expression

it feels weird. I mean http://3v4l.org/ZeZR1 is not doable without a separate variable. The meaning of y in $x->y() and $x->y differs so I am not sure it should be swept into a single "member-selection-expression".


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-28 22:42 UTC] stas@php.net
-PHP Version: Irrelevant +PHP Version: PHP-5.6
 [2016-06-29 14:42 UTC] cmb@php.net
> postfix-increment-expression
> postfix-decrement-expression

It is already stated that "the operand of the […] operators must
be a modifiable lvalue that has scalar-compatible type.

> exponentiation-expression

I'm not sure to what you are referring to. The following works as
expected (see <https://3v4l.org/YK35q>):

  trim('2') ** trim('3')

> The meaning of y in $x->y() and $x->y differs so I am not sure
> it should be swept into a single "member-selection-expression".

Syntactically, it has to.

> member-selection-expression
>
> it feels weird. I mean http://3v4l.org/ZeZR1 is not doable
> without a separate variable.

This issue has been addressed as of PHP 7.0.0. For PHP 5.6 the
langspec is indeed in error, because the code would be
syntactically valid and the langspec doesn't mention a respective
constraint.
 [2016-11-11 21:57 UTC] nikic@php.net
Now at: https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#member-access-operator

member-selection-expression has been split into member-access-expression and member-call-expression. Additionally, both were adjusted to accurate specify what is allowed on their LHS (and RHS, for that matter).
 [2016-11-11 21:57 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC