ID: 15114 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Class/Object related Operating System: Suse Linux PHP Version: 4.1.1 New Comment:
Hm, strange...Maybe the error does not occur on a Windows system (I have a Linux server)!? And no: I do not include any other File. Thanks, Arash Previous Comments: ------------------------------------------------------------------------ [2002-01-26 00:19:42] [EMAIL PROTECTED] I was unable to reproduce this bug. The following code executes as expected for me (Win2k/Apache PHP 4.1.1): class Bike { function Bike() { echo 'Constructor of class "Bike"<br>'; } } class MountainBike extends Bike { } $mb = new MountainBike(); class Bike2 { function Bike2() { echo 'Constructor of class "Bike2"<br>'; } } class MountainBike2 extends Bike2 { function MountainBike2() { parent::Bike2(); } } $mb = new MountainBike2(); It outputs: Constructor of class "Bike" Constructor of class "Bike2" with no compile errors. Double check that you aren't including a wrong file, etc. ------------------------------------------------------------------------ [2002-01-19 11:24:10] [EMAIL PROTECTED] In the documentation (http://www.php.net/manual/en/language.oop.constructor.php) you defined the following rule: "If a class has no constructor, the constructor of the base class is being called, if it exists" This worked in PHP 4.0.6 for me. After upgrading to Version 4.1.1, it doesn't. Here are my test-scripts. The first one ends up with no output or the errormessage: "Fatal error: Cannot instantiate non-existent class: mountainbike in /www/testOO.php on line 15". actually, the behaviour seems to be undefined. The second one works, as it should be, but only because of actively calling the constructor of the base class. FIRST: <?php class Bike { function Bike() { echo 'Constructor of class "Bike"'; } } class MountainBike extends Bike { } $mb = new MountainBike(); ?> SECOND: <?php class Bike { function Bike() { echo 'Constructor of class "Bike"'; } } class MountainBike extends Bike { function MountainBike() { parent::Bike(); } } $mb = new MountainBike(); ?> Greetings, Arash My configure line is: ./configure \ --with-apxs=/usr/local/apache/1.3.20/bin/apxs \ --enable-track-vars \ --enable-ftp \ --with-zlib \ --with-gd \ --with-pdflib \ --with-sockets \ --enable-sockets \ --with-sysvshm \ --with-sysvsem \ --enable-dbg=shared \ --with-dbg-profiler \ --with-mysql=/usr/local/mysql/current \ --with-pgsql=/usr/local/pgsql \ --with-mcrypt ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=15114&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]