php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-23 10:33 UTC] aharvey@php.net
-Status: Open +Status: Duplicate -Package: Feature/Change Request +Package: *General Issues
 [2010-11-23 10:33 UTC] aharvey@php.net
Duplicate of request #34502.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC