Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67489 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27986 invoked from network); 24 May 2013 13:15:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2013 13:15:01 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-ie0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:51276] helo=mail-ie0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/B7-20943-3D76F915 for ; Fri, 24 May 2013 09:15:00 -0400 Received: by mail-ie0-f177.google.com with SMTP id 9so11543687iec.8 for ; Fri, 24 May 2013 06:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=ZJNWYcrKVNQqWxA9iytI9PWf062F0ip2540nt+kMI6I=; b=X1aCXz5ze5g0b3RGK3EvIGHtJ/P+hZu29EGlzDqZE2327J68OelwtSmVzUk+cJgfRn O7e6wSl21jE5jp03nUU/qE8w/R69/HdfyLxPm7eaQ1wtRDE60ScGaXWi2Yoo+F/yp56H AEoSVEXzhRT8e7efR6lbQKfqPOxDlUMJB6GR0YjxTtP302SLvVJTxwoD/Btex0Rj+ly6 AlrCTTD58gf11H+tsERU56Mc+7whZMk/aLDUw07py4Uaa16xkwETcZcSTKj0E9B4C5tD V+Vx97JpY7BLonqox+uCxQSdhP999HzuVJ/QXyBp/mKMI2IPtBqz6ClokQlRw0JRelrU Es6w== X-Received: by 10.50.97.38 with SMTP id dx6mr8419785igb.45.1369401296360; Fri, 24 May 2013 06:14:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.96.74 with HTTP; Fri, 24 May 2013 06:14:34 -0700 (PDT) Reply-To: RQuadling@GMail.com In-Reply-To: References: <6b642a96e673c29dbaf2f239be15f7f6.squirrel@www.l-i-e.com> <519E8ADB.90202@sugarcrm.com> Date: Fri, 24 May 2013 14:14:34 +0100 Message-ID: To: Ferenc Kovacs Cc: Stas Malyshev , Etienne Kneuss , Anthony Ferrara , Richard Lynch , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b10d1dbd31c1e04dd769541 Subject: Re: [PHP-DEV] Cannot call constructor From: rquadling@gmail.com (Richard Quadling) --047d7b10d1dbd31c1e04dd769541 Content-Type: text/plain; charset=UTF-8 On 24 May 2013 13:11, Ferenc Kovacs wrote: > On Thu, May 23, 2013 at 11:32 PM, Stas Malyshev >wrote: > > > Hi! > > > > > Right now, to avoid this situation, you have to do: > > > if (method_exists(get_parent_class(), '__construct')) > > > parent::__construct(); > > > > > > If you don't check for the method existing, you get: > > > Fatal error: Cannot call constructor ... > > > > This makes a lot of sense. I think we also discussed this idea some time > > ago, but it didn't go anywhere that time... > > > last time it was discussed on the list: > http://www.mail-archive.com/internals@lists.php.net/msg50504.html > to summarize it: > Etienne was arguing that for the concrete example (Spl classes) it would be > better to make sure that the object is properly initialized so having a > constructor in the spl classes. > Anthony was the only one who was against the idea of removing the error > when you call a parent constructor which doesn't (explicitly) have one. > Otherwise everybody else seemed to agree with the above change and only the > implementation was discussed: > - we should remove the error completelly > - we should make the error less serious (please don't do this) > - we should always create a common ancestor for every class by default > which have an empty constructor/destructor > - we should always create an empty constructor/desctructor for every class > without it. > > So maybe we could discuss this and based on the feedback create an rfc > (with or without a vote for the alternative implementations). Hi. I'm not an expert here, so just thinking out loud ... If a theoretical \PHP\baseclass can have empty __construct()/__destruct(), what about the other magic methods? OK, I suppose cascading some of the magic methods to a parent and having a null parent at the very very bottom of the heap sounds useful. But I'm not totally sure. Is there much/any need for a true base class that ALL classes will extend from, including those in extensions. Richard. -- Richard Quadling Twitter : @RQuadling EE : http://e-e.com/M_248814.html Zend : http://bit.ly/9O8vFY --047d7b10d1dbd31c1e04dd769541--