ID:               50981
 Comment by:       clarity1285 at gmail dot com
 Reported By:      clarity1285 at gmail dot com
 Status:           Feedback
 Bug Type:         SPL related
 Operating System: Mac OS X
 PHP Version:      5.3.1
 New Comment:

Tested with PHP 5.3.3-dev snapshot provided, and the issue is still 
reproducible.


Previous Comments:
------------------------------------------------------------------------

[2010-02-12 17:23:50] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------

[2010-02-12 17:04:55] aleksey dot v dot korzun at gmail dot com

I'm experiencing the same issue.

------------------------------------------------------------------------

[2010-02-09 23:05:48] clarity1285 at gmail dot com

Description:
------------
When there are 11 total items and you use a LimitIterator to get the 
first 10, CachingIterator::hasNext() returns false even though there
are 
more than 10 items in the initial set.

If there are 12 total items it works as expected.

Reproduce code:
---------------
$items = new ArrayObject(range(1,11));

echo 'there are ' . $items->count() . ' total items' . "\r\n";

$cachingIterator = new CachingIterator($items->getIterator());

$limitIterator = new LimitIterator($cachingIterator, 0, 10);

$i = 0;
foreach ($limitIterator as $item) {
    ++$i;
}

echo 'first page has ' . $i . ' items' . "\r\n";

if ($cachingIterator->hasNext()) {
    echo 'there is a next page';
} else {
    echo 'there is no next page';
}

Expected result:
----------------
The code should output:

there are 11 total items 
first page has 10 items 
there is a next page

Actual result:
--------------
The code outputs:

there are 11 total items 
first page has 10 items 
there is no next page


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50981&edit=1

Reply via email to