#28831 [Opn->Bgs]: ArrayObject::offsetGet() does not return a stored ArrayObject
| From: | helly@php.net | Date: | Fri, 18 Jun 2004 18:55:23 +0000 |
| Subject: | #28831 [Opn->Bgs]: ArrayObject::offsetGet() does not return a stored ArrayObject | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61083@lists.php.net to get a copy of this message | ||
ID: 28831
Updated by: helly@php.net
Reported By: nospam0 at malkusch dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5CVS-2004-06-18 (dev)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Unfortunatley internal functions cannot return a reference.......
Try this code:
<?php
$array = new ArrayObject();
$subArray = new ArrayObject();
$array->append($subArray);
$subArray->append('item');
var_dump($array);
$x=$array->offsetGet(0);
$x->append('item2');
var_dump($array);
var_dump($x);
?>
Previous Comments:
------------------------------------------------------------------------
[2004-06-18 16:19:13] nospam0 at malkusch dot de
Description:
------------
If I save an ArrayObject in an ArrayObject, I can't
manipulate the stored ArrayObject, by getting it with
offsetGet()
Reproduce code:
---------------
$array = new ArrayObject();
$subArray = new ArrayObject();
$array->append($subArray);
$subArray->append('item');
var_dump($array);
$array->offsetGet(0)->append('item2');
var_dump($array);
Expected result:
----------------
object(ArrayObject)#23 (1) {
[0]=> object(ArrayObject)#24 (1) {
[0]=> string(4) "item" } }
oobject(ArrayObject)#23 (1) {
[0]=> object(ArrayObject)#24 (1) {
[0]=> string(4) "item",
[1]=> string(5) "item2" } }
Actual result:
--------------
object(ArrayObject)#23 (1) {
[0]=> object(ArrayObject)#24 (1) {
[0]=> string(4) "item" } }
object(ArrayObject)#23 (1) { [0]=> NULL }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28831&edit=1