Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52401 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29974 invoked from network); 16 May 2011 18:32:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2011 18:32:06 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 ns.km36107.keymachine.de Received: from [217.114.211.66] ([217.114.211.66:47382] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/9F-26716-5AD61DD4 for ; Mon, 16 May 2011 14:32:06 -0400 Received: from [192.168.2.230] (ppp-93-104-44-192.dynamic.mnet-online.de [93.104.44.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 87FD772EB2; Mon, 16 May 2011 20:32:02 +0200 (CEST) To: Andrew Curioso Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Mon, 16 May 2011 20:32:00 +0200 Message-ID: <1305570720.1344.535.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Inconsistencies with constructors in SPL From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) Hi, I|d actuallz suggest a different option: If a parent constructor is called but doesn't exist the engine should ignore this. The same goes for destructors. This solution would also work for userland classes. johannes On Mon, 2011-05-16 at 14:14 -0400, Andrew Curioso wrote: > So, I ran across bug #54631 > > A fatal error is thrown if you try to call parent::__construct() from a > subclass > of SplObjectStorage. > > I was going to close it as "expected behavior" since that is pretty normal > if the parent class doesn't implement __construct(). > Also, the docs don't list it as having a __construct() method. > > But then look at SplDoublyLinkedList (and a bunch of others). They are > documented > as having a __construct() method, yet it triggers a fatal error when you try > to call > "parent::__construct()" from a subclass' constructor . > > So it seems to me that there are two possible solutions: > > - Update the docs to remove ::__construct() for classes that don't have one. > - Make sure __construct() is implemented in all SPL classes * and update the > docs. > > * Even if it is empty. > > What's everyone thinking? > > I'd be more than happy to add the constructors to the code where needed, I > just > want to make sure that it is the right move first. > > > - Andrew