Bug #16847: initialization function in extended class resets parent class variables
| From: | alexg at syspro dot co dot za | Date: | Fri, 26 Apr 2002 10:54:40 +0000 |
| Subject: | Bug #16847: initialization function in extended class resets parent class variables | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-6086@lists.php.net to get a copy of this message | ||
From: alexg@syspro.co.za
Operating system: linux 2.4.0
PHP version: 4.1.2
PHP Bug Type: Class/Object related
Bug description: initialization function in extended class resets parent class variables
When including an initialization function within both A and B classes,
creating an instance of he extending B class resets the variable
value created by initialization function withing the A class
class A {
var $var_a;
function A() {
$this->var_a = "a";
}
}
class B extends A {
var $var_b;
function B() {
$this->var_b = "b";
}
}
$test = new B;
echo $test->var_a; //no output unless I comment out function B() in class
B
echo $test->var_b;
--
Edit bug report at http://bugs.php.net/?id=16847&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16847&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16847&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16847&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16847&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16847&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16847&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16847&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16847&r=submittedtwice