From:             d dot freise at gmx dot de
Operating system: SuSE Linux 8.1/i386
PHP version:      4.3.1
PHP Bug Type:     Unknown/Other Function
Bug description:  Bug? Feature? Classes and Contructors

Hi!

I'm not a 100% certain if this is a bug, but it made me think of it...

Here is some sample code:

---

class A {
   var $test;
   function A() { $this->test = 1; }
}
class B extends A {
   function B() {}
   function out() { echo $this->test; }
}

$test = &new B;
$test->out();

---

The abose sample will output "" - an empty string. I found out that the
contructor of class A is never called. I'm programing a lot with C++ and
find this behaviour odd. All contructors of derived classes should be
called.

I searched the bug database and found bug #1856 - rather old - telling me
that it should be fixed in CVS that times.

If this an intended behaviour, please excuse me for disturbing ;-)

Dennis Freise

-- 
Edit bug report at http://bugs.php.net/?id=22675&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22675&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22675&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22675&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22675&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22675&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22675&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22675&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22675&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22675&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22675&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22675&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22675&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22675&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22675&r=gnused

Reply via email to