Bug #64431 [Opn->Nab]: SPL RecursiveArrayIterator::offsetSet with ArrayObject fails but stdClass works
| From: | ab@php.net | Date: | Mon, 06 Jan 2014 09:08:25 +0000 |
| Subject: | Bug #64431 [Opn->Nab]: SPL RecursiveArrayIterator::offsetSet with ArrayObject fails but stdClass works | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183607@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64431&edit=1
ID: 64431
Updated by: ab@php.net
Reported by: namarpi at yahoo dot com
Summary: SPL RecursiveArrayIterator::offsetSet with
ArrayObject fails but stdClass works
-Status: Open
+Status: Not a bug
Type: Bug
Package: SPL related
Operating System: Windows
PHP Version: 5.4.13
Block user comment: N
Private report: N
New Comment:
Hi,
grateful thanks for your offer with the test scripts. I think it had much more sense to turn your
scripts into teh phpt test cases and then do a PR on github. Please see http://qa.php.net/howtohelp.php for how to write test
cases, and please reduce the test code to the absolute required minimum. The smaller the repro code
is, the easier it is to debug errors.
Cheers
Previous Comments:
------------------------------------------------------------------------
[2013-03-27 17:01:40] namarpi at yahoo dot com
I would like to insert new nodes into the array with iterator, but the solutions in the previously
linked test script were not consistent. So, found a better way to insert and modify new nodes
dynamically, and append them to the iterator on the fly. This works so smooth and nice that it must
be a good solution in the case of stdClass.
https://github.com/NaMarPi/php-reports/blob/master/insertNewNode.php
------------------------------------------------------------------------
[2013-03-22 07:54:47] namarpi at yahoo dot com
I think it might be interesting:
Manual says: public void ArrayIterator::offsetSet ( string $index , string $newval )
but thank to Developer it works with offsetSet ( string $index , array/stdClass $newnode ) too.
https://github.com/namarpi/php-reports/blob/master/offsetSet-string-and-array.php
------------------------------------------------------------------------
[2013-03-20 19:17:59] namarpi at yahoo dot com
Hello,
good news: method chaining works (leastwise two levels), so apology for
the rumor. Here is the script which contains two solutions, one for RecursiveIteratorIterator, and
one for RecursiveArrayIterator. It would be really nice to complete this wiki page: http://en.wikipedia.org/wiki/Method_chaining
:))
https://github.com/namarpi/php-reports/blob/master/methodChain.php
------------------------------------------------------------------------
[2013-03-18 05:47:49] namarpi at yahoo dot com
Hello again,
I would like to offer my help with some simple test scripts, which will be collected at
https://github.com/namarpi/PHP-SPL-Recursive-Examples
If you need them use them.
------------------------------------------------------------------------
[2013-03-17 06:25:25] namarpi at yahoo dot com
Perhaps you have already faced with that too, that method chaining fails even with stdClass. If not
than this script provides an example:
https://github.com/namarpi/php-reports/blob/master/insertGrandchildByGrandparentKey.php
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64431
--
Edit this bug report at https://bugs.php.net/bug.php?id=64431&edit=1