[PHP-DEV] Bug #11092: (Yet Another) References Weirdness From: sbergmann <email protected>
Date: 05/24/01

From: sbergmann <email protected>
Operating system: should be OS independent
PHP version: 4.0.5
PHP Bug Type: Scripting Engine problem
Bug description: (Yet Another) References Weirdness

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();
?>

-- 
Edit Bug report at: http://bugs.php.net/?id=11092&edit=1

-- 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>