Req #62662 [Com]: ArrayObject applied deep inside the array
| From: | klaussantana at gmail dot com | Date: | Wed, 25 Jul 2012 19:18:02 +0000 |
| Subject: | Req #62662 [Com]: ArrayObject applied deep inside the array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172236@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62662&edit=1
ID: 62662
Comment by: klaussantana at gmail dot com
Reported by: klaussantana at gmail dot com
Summary: ArrayObject applied deep inside the array
Status: Open
Type: Feature/Change Request
Package: SPL related
Operating System: All
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The example above is a simple case to show that it not work.
The new flag would unleash a tons of possibilities of application like when you're
mapping a database with object orientation.
<?php echo $MyDBMap->database->table->column; ?>
Previous Comments:
------------------------------------------------------------------------
[2012-07-25 19:10:44] klaussantana at gmail dot com
Description:
------------
New flag to ArrayObject: DEEP_CONVERSION.
This flag would make ArrayObject inspect the array $input indexes for others
arrays and also instantiate an ArrayObject with the index array also with the same
$flags and the same $iterator_class.
Test script:
---------------
<?php
$Array = array();
$Array['string'] = 'string';
$Array['array'] = array();
$Array['array'][] = 'string';
$Array['array'][] = 'string';
$Array['array'][] = 'string';
$Array['matrix'] = array();
$Array['matrix']['string1'] = 'string';
$Array['matrix']['string2'] = 'string';
$Array['matrix'][] = 'string';
$Array['matrix'][] = 'string';
$Array['matrix']['array1'] = array();
$Array['matrix']['array1'][] = 'string';
$Array['matrix']['array1'][] = $Array['array'];
$Array['matrix']['array1'][] = 'string';
$Array['matrix']['array1']['string'] = 'string';
$Array['matrix']['array2'] = array();
$Array['matrix']['matrix'] = array();
$Array['matrix']['matrix']['array'] =
$Array['matrix']['array1'];
$Array['matrix']['matrix'][] =
$Array['matrix']['matrix']['array'];
$Array['matrix']['string3'] = 'string';
$Array['matrix'][] = null;
$Array = new ArrayObject($Array, ArrayObject::ARRAY_AS_PROPS);
echo $Array->matrix->matrix[0][1][0];
?>
Expected result:
----------------
string
Actual result:
--------------
(!) Notice: Trying to get property of non-object in D:\WWW\sandbox.php on line 32
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62662&edit=1