Icinga\Protocol\File\Reader::fetchPairs(): increase $index manually as the iterator's one makes trouble

refs #7060
This commit is contained in:
Alexander Klimov 2014-09-03 18:36:59 +02:00
parent e45f50408a
commit ede5b8f0b9
1 changed files with 3 additions and 1 deletions

View File

@ -154,13 +154,15 @@ class Reader extends FilterIterator
$skip = $count - ($skip + $read);
}
}
foreach ($this as $index => $line) {
$index = 0;
foreach ($this as $line) {
if ($index >= $skip) {
if ($index >= $skip + $read) {
break;
}
$lines[] = $line;
}
++$index;
}
if ($query->sortDesc()) {
$lines = array_reverse($lines);