|  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
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:
Solve the problem:
15 - 7 = ?
Subscribe to this entry?

 [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-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 20 18:01:26 2020 UTC