Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69636 invoked by uid 1010); 20 Apr 2005 14:30:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69621 invoked from network); 20 Apr 2005 14:30:53 -0000 Received: from unknown (HELO php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2005 14:30:53 -0000 X-Host-Fingerprint: 69.64.38.41 bluga.net Linux 2.5 (sometimes 2.4) (4) Received: from ([69.64.38.41:35342] helo=bluga.net) by pb1.pair.com (ecelerity 1.2.12rc1 r(5476:5477)) with SMTP id 05/75-45122-D9766624 for ; Wed, 20 Apr 2005 10:30:53 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by bluga.net (Postfix) with ESMTP id A584F21C786; Wed, 20 Apr 2005 09:28:41 -0500 (CDT) Received: from bluga.net ([127.0.0.1]) by localhost (bluga.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03663-10; Wed, 20 Apr 2005 09:28:41 -0500 (CDT) Received: from [192.168.0.102] (cpe-66-65-39-8.nyc.res.rr.com [66.65.39.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bluga.net (Postfix) with ESMTP id 49A3F21C163; Wed, 20 Apr 2005 09:28:41 -0500 (CDT) Message-ID: <42666796.8080404@php.net> Date: Wed, 20 Apr 2005 10:30:46 -0400 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Johannes Schlueter Cc: internals@lists.php.net References: <20050420031150.63328.qmail@lists.php.net> <20050420122407.0345f3ce.antony@zend.com> <42665E99.8000609@chiaraquartet.net> <20050420141130.41087.qmail@lists.php.net> In-Reply-To: <20050420141130.41087.qmail@lists.php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at bluga.net Subject: Re: [PHP-DEV] protected/private function __construct() not allowed in 5.0.4? From: cellog@php.net (Greg Beaver) Johannes Schlueter wrote: > Hi Greg, > > Greg Beaver wrote: > > >>Try this code (which worked in 5.0.3) >> >>>class a { public function __construct(){}} >>class b extends a { protected function __construct(){}} >>?> > > > This was changed since such a change of visibility makes no sense - if you > extend a class it should still be compatible with it's parent class. I highly recommend removing this restriction for constructors. The programmer should be the one to determine whether this makes sense. For other methods that are not instance-dependent, this restriction makes perfect sense. most methods can be called by any instance without needing to know what the class is. constructors are not like this. They are tightly bound to the specific class they are in. The same reasoning was used to remove the restrictions on constructor arguments - constructors are not normal methods. I am extending a general purpose XML_RPC server implementation which is designed to be instance based, and making it a singleton. There is nothing wrong with this, and object instances are still 100% compatible. Nobody in their right mind expects to be able to instantiate a child class without knowing anything about it - each class does something unique and possibly incompatible with the base class, otherwise there would be no point in extending the base class. This seems a case of PHP trying to prevent me from doing logic errors without knowing anything about the code, i.e. not in the PHP spirit. Greg