From:             [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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to