|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48246 Allow the new statement to be a value.
Submitted: 2009-05-12 14:53 UTC Modified: 2010-11-23 10:33 UTC
From: mathieu dot suen at easyflirt dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.2.9 OS: not relevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mathieu dot suen at easyflirt dot com
New email:
PHP Version: OS:


 [2009-05-12 14:53 UTC] mathieu dot suen at easyflirt dot com
The new statement can only be use insid a assignement statement.
ex: $a = new A();

It would be better to also allow it in other statement like the invokation:

(new A())->foo()

In other word "new A()" should be a valuable statement.

Reproduce code:
(new A())->foo()

Expected result:
The method foo() is invoked on the newlly created object

Actual result:
Compilation error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-23 10:33 UTC]
-Status: Open +Status: Duplicate -Package: Feature/Change Request +Package: *General Issues
 [2010-11-23 10:33 UTC]
Duplicate of request #34502.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sat Nov 17 01:01:26 2018 UTC