Date: 05/24/01
- Next message: bub <email protected>: "[PHP-DEV] Bug #11059 Updated: PHP does not register GET variables $HTTP_GET_VARS is empty. POST works OK."
- Previous message: bub <email protected>: "[PHP-DEV] Bug #11059 Updated: PHP does not register GET variables $HTTP_GET_VARS is empty. POST works OK."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 11092
Updated by: sbergmann
Reported By: sbergmann <email protected>
Status: Open
Bug Type: Scripting Engine problem
Operating system:
PHP Version: 4.0.5
Assigned To:
Comments:
Just noticed: It works as expected when I replace
$a = $b->add_a();
with
$a =& $b->add_a();
But this is not the syntax I was thinking of for my class. The user, which probably doesn't know of the class's internals, now has always use the =& assignment operator. This is definetly error-prone.
Previous Comments:
---------------------------------------------------------------------------
[2001-05-24 13:04:25] sbergmann <email protected>
There seems to be a problem with objects returned from class methods by reference:
<?php
class a {
var $data;
function add_data($data) {
$this->data[] = $data;
}
}
class b {
var $a;
function &add_a() {
$this->a = new a;
return $this->a;
}
function dump() {
print_r($this->a->data);
}
}
$b = new b;
$a = $b->add_a();
$a->add_data('test'); // works not
$b->a->add_data('test'); // works
$b->dump();
?>
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11092&edit=2
-- 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: bub <email protected>: "[PHP-DEV] Bug #11059 Updated: PHP does not register GET variables $HTTP_GET_VARS is empty. POST works OK."
- Previous message: bub <email protected>: "[PHP-DEV] Bug #11059 Updated: PHP does not register GET variables $HTTP_GET_VARS is empty. POST works OK."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

