From: seva dot lapsha at gmail dot com
Operating system: ALL
PHP version: 5.3.0
PHP Bug Type: SPL related
Bug description: AppendIterator::append($iterator) calls $iterator->rewind()
with no reason
Description:
------------
AppendIterator::append($iterator) calls $iterator->rewind() with no
reason.
This causes append to happen twice:
1) when $iterator appended;
2) when $iterator starts iterating.
Reproduce code:
---------------
<?php
class ArrayIterator1 extends ArrayIterator {
function rewind() {
echo ".";
parent::rewind();
}
}
$i1 = new ArrayIterator1(array(1, 2, 3));
$i2 = new ArrayIterator1(array(4, 5, 6));
$i = new AppendIterator();
$i->append($i1);
$i->append($i2);
foreach ($i as $n) {
echo $n;
}
?>
Expected result:
----------------
.123.456
rewind() of each append()ed iterator should be called on demand when
iterating and not when append()ing.
Actual result:
--------------
..123.456
On each append() each append()ed iterator's rewind is called with no need.
--
Edit bug report at http://bugs.php.net/?id=49104&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49104&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49104&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49104&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49104&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49104&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49104&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49104&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49104&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49104&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49104&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49104&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49104&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49104&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49104&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49104&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49104&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49104&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49104&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49104&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49104&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49104&r=mysqlcfg