Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16042 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1417 invoked by uid 1010); 20 Apr 2005 08:06:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1134 invoked from network); 20 Apr 2005 08:06:26 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 20 Apr 2005 08:06:26 -0000 X-Host-Fingerprint: 81.169.182.136 h59705.serverkompetenz.net Linux 2.4/2.6 Received: from ([81.169.182.136:59419] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 1.2.12rc1 r(5476:5477)) with SMTP id CF/E4-45122-18D06624 for ; Wed, 20 Apr 2005 04:06:25 -0400 Received: from baumbart.mbo (dsl-082-083-246-157.arcor-ip.net [82.83.246.157]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 67C7835C1DB; Wed, 20 Apr 2005 10:13:55 +0200 (CEST) Date: Wed, 20 Apr 2005 10:06:22 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1182624491.20050420100622@marcus-boerger.de> To: Greg Beaver Cc: internals@lists.php.net In-Reply-To: <20050420031150.63328.qmail@lists.php.net> References: <20050420031150.63328.qmail@lists.php.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] protected/private function __construct() not allowed in 5.0.4? From: mail@marcus-boerger.de (Marcus Boerger) Hello Greg, Wednesday, April 20, 2005, 5:11:46 AM, you wrote: > Hi all, > I just spent quite a while searching the archives, and can't find any > explanation of why this code worked in 5.0.3 but doesn't in 5.0.4: > class blah { > protected function __construct(){} > } ?>> > Could someone please enlighten me? I was using this for a singleton > pattern, and so it would be nice to know why it is so critical for the > engine to be anal retentive here. It seems to me that it should be up > to the programmer to decide how easily the object can be instantiated, > unless there is a deeper engine stability issue. > Thanks, > Greg At least it works for 5.0.5-dev: marcus@zaphod /usr/src/php-cvs $ php -r 'class T { protected function __construct() {} static function test() { return new T;} } var_dump(T::test());' make: `sapi/cli/php' is up to date. object(T)#1 (0) { } marcus@zaphod /usr/src/php-cvs $ ../PHP_5_0/sapi/cli/php -r 'class T { protected function __construct() {} static function test() { return new T;} } var_dump(T::test());' object(T)#1 (0) { } marcus@zaphod /usr/src/php-cvs $ ../PHP_5_0/sapi/cli/php -v PHP 5.0.5-dev (cli) (built: Apr 7 2005 17:24:12) (DEBUG) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies but i currently cannot reproduce it with 5.0.4, sorry. -- Best regards, Marcus mailto:mail@marcus-boerger.de