Re: protected/private function __construct() not allowed in 5.0.4?

From: Date: Wed, 20 Apr 2005 13:52:25 +0000
Subject: Re: protected/private function __construct() not allowed in 5.0.4?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-16044@lists.php.net to get a copy of this message
Antony Dovgal wrote:
On Tue, 19 Apr 2005 23:11:46 -0400 Greg Beaver <cellog@php.net> 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: <?php 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. <b>Fatal error</b>: Access level to Chiara_PEAR_Server_Frontend_Xmlrpc5_Package ::__construct() must be public (as in class Chiara_XML_RPC5_Server) in <b>c:\php 5\pear\Chiara\PEAR\Server\Frontend\Xmlrpc5.php</b> on line <b>40</b><br /> Try this code (which worked in 5.0.3) <?php class a { public function __construct(){}} class b extends a { protected function __construct(){}} ?> Greg

« previous php.internals (#16044) next »