Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit e321f30

Browse files
committed
Merge pull request #191 from box/close_file_pointer_when_done_writing
Writers did not close written file pointer
2 parents 6c57125 + c31373f commit e321f30

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Spout/Writer/AbstractWriter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ private function resetRowStyleToDefault()
319319
public function close()
320320
{
321321
$this->closeWriter();
322+
323+
if (is_resource($this->filePointer)) {
324+
$this->globalFunctionsHelper->fclose($this->filePointer);
325+
}
326+
322327
$this->isWriterOpened = false;
323328
}
324329
}

src/Spout/Writer/CSV/Writer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ protected function addRowToWriter(array $dataRow, $style)
9696
*/
9797
protected function closeWriter()
9898
{
99-
if ($this->filePointer) {
100-
$this->globalFunctionsHelper->fclose($this->filePointer);
101-
}
102-
10399
$this->lastWrittenRowIndex = 0;
104100
}
105101
}

0 commit comments

Comments
 (0)