#23442 [Opn->Bgs]: Trying to assign a reference inside an overloaded class

From: Date: Thu, 01 May 2003 20:31:58 +0000
Subject: #23442 [Opn->Bgs]: Trying to assign a reference inside an overloaded class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38895@lists.php.net to get a copy of this message
ID: 23442 User updated by: dirk at rackspace dot com Reported By: dirk at rackspace dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Redhat Linux 7.3 PHP Version: 4.3.2RC2 New Comment: It looks like I didn't need the second & inside the constructor for it to keep the reference properly. Previous Comments: ------------------------------------------------------------------------ [2003-05-01 15:23:30] dirk at rackspace dot com I was trying to assign a defined property inside an overloaded class to point at a non-overloaded class or an array. I get: Fatal error: Cannot create references to/from string offsets nor overloaded objects I understand the limitation that I cannot store references to overloaded objects - but the error message does not say references are just not allowed inside of overloaded classes. So is the error message just vague or is this a bug in the way references in overloaded classes work? Here is code that shows the problem <? $list= array(1,2,3,4); class testList { var $list; function testList(&$list) { $this->list = &$list; } } class Test { var $data; var $list; function Test (&$list) { $this->list = &$list; } function __set($name,$value) { } } // Declare the class as overloaded overload ("Test"); $test=new Test(new testList($list)); print var_dump($test->list); $list = array(1,2); print var_dump($test->list); $test=new Test($list); print var_dump($test->list); $list = array(1,2); print var_dump($test->list); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23442&edit=1

« previous php.bugs (#38895) next »