fix: Close playlist streams correctly

This commit is contained in:
Pierre Rudloff 2019-04-20 00:37:49 +02:00
parent cd623bfa36
commit 4537b661e1
2 changed files with 22 additions and 0 deletions

View file

@ -208,4 +208,16 @@ class PlaylistArchiveStream extends TarArchive
return fread($this->buffer, $count); return fread($this->buffer, $count);
} }
/**
* Called when fclose() is used on the stream.
*
* @return void
*/
public function stream_close()
{
if (is_resource($this->buffer)) {
fclose($this->buffer);
}
}
} }

View file

@ -34,6 +34,16 @@ class PlaylistArchiveStreamTest extends TestCase
$this->stream = new PlaylistArchiveStream(Config::getInstance('config/'.$configFile)); $this->stream = new PlaylistArchiveStream(Config::getInstance('config/'.$configFile));
} }
/**
* Clean variables used in tests.
*
* @return void
*/
protected function tearDown()
{
$this->stream->stream_close();
}
/** /**
* Test the stream_open() function. * Test the stream_open() function.
* *