Bug #75155 [NEW]: AppendIterator::append() is broken when appending another AppendIterator
| From: | bschussek at gmail dot com | Date: | Mon, 04 Sep 2017 15:22:05 +0000 |
| Subject: | Bug #75155 [NEW]: AppendIterator::append() is broken when appending another AppendIterator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210932@lists.php.net to get a copy of this message | ||
From: bschussek at gmail dot com
Operating system: ubuntu 16.04 LTS
PHP version: 7.1.9
Package: SPL related
Bug Type: Bug
Bug description:AppendIterator::append() is broken when appending another AppendIterator
Description:
------------
When passing another AppendIterator to AppendIterator::append(), the
entire AppendIterator is returned during iteration instead of the
individual entries.
Test script:
---------------
<?php
$array_a = new ArrayIterator(array('a', 'b', 'c'));
$array_b = new ArrayIterator(array('d', 'e', 'f'));
$iterator = new AppendIterator;
$iterator->append($array_a);
$iterator2 = new AppendIterator;
$iterator2->append($iterator);
$iterator2->append($array_b);
foreach ($iterator2 as $current) {
echo $current;
}
Expected result:
----------------
abcdef
Actual result:
--------------
PHP Catchable fatal error: Object of class ArrayIterator could not be
converted to string
--
Edit bug report at https://bugs.php.net/bug.php?id=75155&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75155&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75155&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75155&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75155&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75155&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75155&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75155&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75155&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75155&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75155&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75155&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75155&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75155&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75155&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75155&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75155&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75155&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75155&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75155&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75155&r=mysqlcfg