From:             [EMAIL PROTECTED]
Operating system: Suse Linux
PHP version:      4.1.1
PHP Bug Type:     Class/Object related
Bug description:  Constructor Rule, defined for PHP4 does not work in PHP4.1.1

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 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]

Reply via email to