You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
RowIterator::prev() not throwing an exception if you go out of bounds.
What is the current behavior?
RowIterator::prev() throwing an exception if you go out of bounds.
thrownewPhpSpreadsheetException("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
}
But, how iterators work, they WILL go out of bounds and then call valid(). You can see this by having next() not check if it's out of bounds, it just does.
I believe this to be a bug.
Which versions of PhpSpreadsheet and PHP are affected?
Latest master, as linked.
The text was updated successfully, but these errors were encountered:
dkarlovi
added a commit
to dkarlovi/PhpSpreadsheet
that referenced
this issue
Aug 7, 2018
Iterators prev() behavior is now consistent with next(), meaning
that it can go out of bounds and it must be validated with valid()
before using it.
FixesPHPOffice#587FixesPHPOffice#627
This is:
What is the expected behavior?
RowIterator::prev()
not throwing an exception if you go out of bounds.What is the current behavior?
RowIterator::prev()
throwing an exception if you go out of bounds.What are the steps to reproduce?
I've implemented an
RowIterator
decorator which allows me to iterate in reverse,https://github.com/dkarlovi/xls-transmailifier/blob/command/src/Transmailifier/ReverseRowIterator.php#L63
The way current code works, it will throw an exception if you try to go out of bounds:
PhpSpreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php
Lines 160 to 162 in 043327b
But, how iterators work, they WILL go out of bounds and then call
valid()
. You can see this by havingnext()
not check if it's out of bounds, it just does.I believe this to be a bug.
Which versions of PhpSpreadsheet and PHP are affected?
Latest master, as linked.
The text was updated successfully, but these errors were encountered: