Date: 06/27/01
- Next message: Sergio Bruder: "Re: [PHP-DEV] Apache coredumps with php4 with runtime modules ldap and imap loaded"
- Previous message: Hojtsy Gabor: "[PHP-DEV] Bug sent manually [the php.net mailing is not working now :(]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: zork <email protected>
Operating system: Linux 2.2.x
PHP version: 4.0 Latest CVS (2001-06-27)
PHP Bug Type: Class/Object related
Bug description: setting reference to $this in constructor.
When I want to set reference to $this object gets copied.
In this example $ui_handler contains copy of object $test.
$ui_handler -> data is not reference to $test.
I use CVS 2001-06-24.
<?
class CUI_element {
var $value;
function CUI_element($value) {
global $ui_handler;
$this -> value = $value;
$ui_handler -> register($this);
}
}
class CUI_handler {
var $data;
function CUI_handler() {
$this -> data = false;
}
function register(&$element) {
$this -> data = &$element;
}
};
$ui_handler = new CUI_Handler();
$test = new CUI_Element("test");
$test -> value = "changed";
var_dump($ui_handler -> data); print "<br>";
var_dump($test); print "<br>";
?>
My output:
object(cui_element)(1) { ["value"]=> string(4) "test" }
object(cui_element)(1) { ["value"]=> string(7) "changed" }
Working url: http://biuro.pablosoft.com.pl/~zork/ref/tests.php
regards,
Zork.
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Sergio Bruder: "Re: [PHP-DEV] Apache coredumps with php4 with runtime modules ldap and imap loaded"
- Previous message: Hojtsy Gabor: "[PHP-DEV] Bug sent manually [the php.net mailing is not working now :(]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

