Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16047 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75117 invoked by uid 1010); 20 Apr 2005 14:34:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75102 invoked from network); 20 Apr 2005 14:34:56 -0000 Received: from unknown (HELO zend.com) (127.0.0.1) by localhost with SMTP; 20 Apr 2005 14:34:56 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:59080] helo=mail.zend.com) by pb1.pair.com (ecelerity 1.2.12rc1 r(5476:5477)) with SMTP id 07/F5-45122-E8866624 for ; Wed, 20 Apr 2005 10:34:56 -0400 Received: (qmail 17998 invoked from network); 20 Apr 2005 14:34:49 -0000 Received: from internal.zend.office (HELO localhost) (10.1.1.1) by internal.zend.office with SMTP; 20 Apr 2005 14:34:49 -0000 Date: Wed, 20 Apr 2005 18:34:45 +0400 To: Greg Beaver Cc: internals@lists.php.net Message-ID: <20050420183445.5d31dca2.antony@zend.com> In-Reply-To: <42665E99.8000609@chiaraquartet.net> References: <20050420031150.63328.qmail@lists.php.net> <20050420122407.0345f3ce.antony@zend.com> <42665E99.8000609@chiaraquartet.net> X-Mailer: Sylpheed version 1.9.7 (GTK+ 2.4.9; i686-pc-linux-gnu) 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: antony@zend.com (Antony Dovgal) On Wed, 20 Apr 2005 09:52:25 -0400 Greg Beaver wrote: > Antony Dovgal wrote: > > >On Tue, 19 Apr 2005 23:11:46 -0400 > >Greg Beaver 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(){} > >>} > >>?> > >> > >> > > > >Works fine with HEAD, 5.0.5-dev & 5.0.4. > >Could you plz explain what did you mean when you said "doesn't work" ? > > > > I didn't read the error message closely enough - when extending the base > class, which has a public constructor, the protected keyword is no > longer allowed. > > Fatal error: Access level to > Chiara_PEAR_Server_Frontend_Xmlrpc5_Package > ::__construct() must be public (as in class Chiara_XML_RPC5_Server) in > c:\php > 5\pear\Chiara\PEAR\Server\Frontend\Xmlrpc5.php on line 40
> > Try this code (which worked in 5.0.3) > > class a { public function __construct(){}} > class b extends a { protected function __construct(){}} > ?> It doesn't work in 5.0.3 too: --------- #./sapi/cli/php -v PHP 5.0.3 (cli) (built: Apr 20 2005 18:26:52) (DEBUG) Copyright (c) 1997-2004 The PHP Group #./sapi/cli/php /www/index.php Fatal error: Access level to b::__construct() must be public (as in class a) in /www/index.php on line 4 --------- As far as I can see this change first appeared somewhere in late 2002, because this patch: http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.337&r2=1.338&ty=u fixes it. -- Wbr, Antony Dovgal aka tony2001 antony@zend.com