Skip to content

Commit 598cf05

Browse files
Ensure Proper Closure of File Handle in LazyCollection (#10269)
1 parent c858eff commit 598cf05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

collections.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,6 +3988,8 @@ LazyCollection::make(function () {
39883988
while (($line = fgets($handle)) !== false) {
39893989
yield $line;
39903990
}
3991+
3992+
fclose($handle);
39913993
})->chunk(4)->map(function (array $lines) {
39923994
return LogEntry::fromLines($lines);
39933995
})->each(function (LogEntry $logEntry) {
@@ -4033,6 +4035,8 @@ LazyCollection::make(function () {
40334035
while (($line = fgets($handle)) !== false) {
40344036
yield $line;
40354037
}
4038+
4039+
fclose($handle);
40364040
});
40374041
```
40384042

0 commit comments

Comments
 (0)