#39426 [NEW]: problem wih __get ant multidimensional arrays
| From: | wmalota at php-art dot pl | Date: | Wed, 08 Nov 2006 08:57:06 +0000 |
| Subject: | #39426 [NEW]: problem wih __get ant multidimensional arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-104562@lists.php.net to get a copy of this message | ||
From: wmalota at php-art dot pl
Operating system: Linux/Debian
PHP version: 5.2.0
PHP Bug Type: Scripting Engine problem
Bug description: problem wih __get ant multidimensional arrays
Description:
------------
Copying an array returned by __get to other array returned by __get from
other object gives wrong effect.
Reproduce code:
---------------
class test {
private $variables = array();
public function & __get($name) {
return $this->variables[$name];
}
public function __set($name, $value) {
$this->variables[$name] = $value;
}
}
$test1 = new test;
$test1->data['sth1'] = 'sth1';
$test1->data['sth2'] = 'sth2';
$test2 = new test;
$test2->data['rewritten'] = $test1->data;
echo($test2->data['rewritten']['sth1']);
Expected result:
----------------
I expected that on the screen I see this text:
sth1
On PHP 5.1.x it works properly.
Actual result:
--------------
On the screen I see text:
Array
--
Edit bug report at http://bugs.php.net/?id=39426&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39426&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39426&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39426&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39426&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39426&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39426&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39426&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39426&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39426&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39426&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39426&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39426&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39426&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39426&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39426&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39426&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39426&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39426&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39426&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39426&r=mysqlcfg