From: luke dot brown28 at gmail dot com Operating system: Windows Server 2008 PHP version: 5.3.24 Package: SPL related Bug Type: Feature/Change Request Bug description:Add constructor parameter or update docs
Description: ------------ --- >From manual page: http://www.php.net/arrayobject.construct#refsect1- arrayobject.construct-examples --- Currently when constructing an ArrayObject it isn't possible to specify whether or not you would like recursion to take place, thus traversing the array structure and creating ArrayObject instances in multi-dimensional arrays. Whilst I appreciate that this is standard behavior, being given the option when constructing would be very useful as you wouldn't then be required to extend the class for what is quite a common use-case. I appreciate it's easy to extend the class and code in the recursion, but I feel a param on construct would be equally as useful (perhaps even as part of the bitwise flags). Failing this, the documentation should at the very least be updated to include an example of instantiating the class with a multi-dimensional array to show that any arrays within the one passed to the constructor will not be converted by ArrayObject. Test script: --------------- $array = array('one' => 1, 'fruit' => array('lemon' => 'bitter', 'orange' => 'sweet')); $obj = new ArrayObject($array); $obj->fuit->orange; // null $obj->fuit['orange'] // 'sweet' -- Edit bug report at https://bugs.php.net/bug.php?id=64756&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64756&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64756&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64756&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64756&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64756&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64756&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64756&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64756&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64756&r=support Expected behavior: https://bugs.php.net/fix.php?id=64756&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64756&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64756&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64756&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64756&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64756&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64756&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64756&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64756&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64756&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64756&r=mysqlcfg