PHP 4.0 Bug #6231: Reference parsing problem
| From: | rezinkin at mail dot ru | Date: | Fri, 18 Aug 2000 08:11:06 +0000 |
| Subject: | PHP 4.0 Bug #6231: Reference parsing problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-29374@lists.php.net to get a copy of this message | ||
From: rezinkin@mail.ru
Operating system: Windows 95 OSR2
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: Reference parsing problem
+++ Wrong class copieng +++
<?
/*
Class BOMain1 and BOMain2 are different in one string see below
*/
class BOMainstr{
// Class attributes
var $ID; // Object ID (integer)
} // end class definition
//-----------------------Class 1----------------------------
class BOMain1{
var $storage; //nested object
function BOMain1 ()
{
$this->storage = new BOMainstr();
}
function get() {
return $this->storage->ID;
}
function set($ID) {
$this->storage->ID = $ID;
}
} // end class definition
//-----------------------Class 2---------------------------- class BOMain2{
var $storage; //nested object
function BOMain2 ()
{
$this->storage = new BOMainstr();
settype($this->storage,'object'); // Different string
}
function get() {
return $this->storage->ID;
}
function set($ID) {
$this->storage->ID = $ID;
}
} // end class definition
$A = new BOMain1();
$A->set(1);
$B = $A;
$B->set(2);
echo "A->get() =>" . $A->get() .'<BR>';
echo "B->get() =>" . $B->get() .'<HR>';
$C = new BOMain2();
$C->set(1);
$D = $C;
$D->set(2);
echo "C->get() =>" . $C->get() .'<BR>';
echo "D->get() =>" . $D->get();
?>