Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19529 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85742 invoked by uid 1010); 9 Oct 2005 10:14:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85727 invoked from network); 9 Oct 2005 10:14:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Oct 2005 10:14:49 -0000 X-Host-Fingerprint: 195.227.108.51 wfserver02.wf-ppr.de Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from ([195.227.108.51:29411] helo=wfserver02.wf-ppr.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C8/2E-54476-89DE8434 for ; Sun, 09 Oct 2005 06:14:49 -0400 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Date: Sun, 9 Oct 2005 12:14:38 +0200 Message-ID: <00A2E2156BEE8446A81C8881AE117F192C15D5@companyweb> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] return /* by reference */ new Foo() in PHP4 Thread-Index: AcXMVm3QaH7Yu3J/SgKHnV+PJK5eoQAYlg6w Cc: Subject: AW: [PHP-DEV] return /* by reference */ new Foo() in PHP4 From: mp@webfactory.de ("Matthias Pigulla") > > So, in case of "return new", wouldn't it make sense to remove the=20 > > warning as the code is 'legal'? And please, don't start a new "it's=20 > > just a friendly notice" flame war. >=20 > It's just a notice, tune your error_reporting level accordingly. Sorry, but that is just a stupid killer argument. I thought I had written something like "please, don't start a new *it's just a friendly notice* flame war".=20 May I conclude that what you really want to say is: "Yes, return /*byref*/ new Foo() _is_ bad code _unless_ inside Foo's constructor, $this is passed around and somebody somewhere stores yet another reference to it. Accept that you wrote broken code: return new Foo() is wrong, it needs to be return $tmp =3D& new Foo()." Shaking his head, Matthias