Commit c4c3bed
committed
Fix GH-8562: SplFileObject::current() returns wrong value after next()
SplFileObject::next() without READ_AHEAD cleared the cached line and
incremented current_line_num but didn't advance the stream. When called
without a preceding current() (e.g. rewind() then next()), the stream
position stayed put, so the subsequent current() read stale data.
Read a line to advance the stream when next() is called with no cached
line.
Closes GH-85621 parent 0f3e741 commit c4c3bed
2 files changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2142 | 2142 | | |
2143 | 2143 | | |
2144 | 2144 | | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
2145 | 2149 | | |
2146 | 2150 | | |
2147 | 2151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments