#22726 [Opn->Csd]: Referencing a parent's private member in a derived class causes its deletion

From: Date: Wed, 23 Apr 2003 08:23:40 +0000
Subject: #22726 [Opn->Csd]: Referencing a parent's private member in a derived class causes its deletion
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38147@lists.php.net to get a copy of this message
ID: 22726 Updated by: magnus@php.net Reported By: sysadmin at alexdupre dot com -Status: Open +Status: Closed Bug Type: Zend Engine 2 problem Operating System: FreeBSD 4-STABLE PHP Version: 5CVS-2003-03-15 (dev) New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-04-23 02:46:15] sysadmin at alexdupre dot com Yes, tested today and now it works. ------------------------------------------------------------------------ [2003-04-19 11:03:25] thekid at thekid dot de With latest CVS, I get: MyClass::printHello() Hello, Bar! MyClass::printHello() Hello, Foo! MyClass::printHello() Hello, Bar! MyClass::printHello() Hello, Foo! MyClass2::printHello2() MyClass2::printHello2() Hello, Foo! I guess this is fixed, then. ------------------------------------------------------------------------ [2003-03-15 04:05:27] sysadmin at alexdupre dot com --TEST-- Referencing a parent's private member in a derived class --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class MyClass { private $Bar = "Hello, Bar!"; protected $Foo = "Hello, Foo!"; public function printHello() { print "MyClass::printHello() " . $this->Bar . "\n"; print "MyClass::printHello() " . $this->Foo . "\n"; } } class MyClass2 extends MyClass { public function printHello2() { $this->printHello(); print "MyClass2::printHello2() " . $this->Bar . "\n"; print "MyClass2::printHello2() " . $this->Foo . "\n"; } } $obj = new MyClass(); $obj->printHello(); $obj = new MyClass2(); $obj->printHello2(); ?> --EXPECT-- MyClass::printHello() Hello, Bar! MyClass::printHello() Hello, Foo! MyClass::printHello() Hello, Bar! MyClass::printHello() Hello, Foo! MyClass2::printHello2() MyClass2::printHello2() Hello, Foo! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22726&edit=1

« previous php.bugs (#38147) next »