#36132 [Opn->Bgs]: CachingIterator do not work well
| From: | sniper@php.net | Date: | Mon, 23 Jan 2006 09:51:03 +0000 |
| Subject: | #36132 [Opn->Bgs]: CachingIterator do not work well | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92378@lists.php.net to get a copy of this message | ||
ID: 36132
Updated by: sniper@php.net
Reported By: quick_defect at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: SPL related
Operating System: *
PHP Version: 5.1.2
Assigned To: helly
New Comment:
Just trust what the author of the code says.
Previous Comments:
------------------------------------------------------------------------
[2006-01-23 10:30:54] quick_defect at yahoo dot com
So you mean a CachingIterator can take more elements than the Iterator
it cached? I can understand that the CachingIterator just caches
Iterator for 1 element. As you know, there are not any documents for
them. So would you PLS to illustrate this?
------------------------------------------------------------------------
[2006-01-23 10:08:50] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Don't try to outsmart them and still expect them to work correct. The
code you presented works exactly as you told it to.
------------------------------------------------------------------------
[2006-01-23 10:00:59] tony2001@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
[2006-01-23 09:51:11] quick_defect at yahoo dot com
Description:
------------
I know I did not use the rewind function as usual. But after I did so,
the behavior of Iterator seemed went wrong.
Reproduce code:
---------------
<?php
$ary=array("1","2");
$ary_obj=new ArrayObject($ary);
$ite=$ary_obj->getIterator();
$c_ite=new CachingIterator($ite);
$ite->rewind();
$c_ite->rewind();
for($axx=$ite;$axx->valid();$axx->next())
{
var_dump($axx->current());
}
echo "*******\n";
$c_ite->rewind();
$ite->rewind();
for($axx=$c_ite;$axx->valid();$axx->next())
{
var_dump($axx->current());
}
?>
Expected result:
----------------
string(1) "1"
string(1) "2"
*******
string(1) "1"
string(1) "2"
Actual result:
--------------
string(1) "2"
*******
string(1) "1"
string(1) "1"
string(1) "2"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36132&edit=1