fix: Close playlist streams correctly
This commit is contained in:
parent
cd623bfa36
commit
4537b661e1
2 changed files with 22 additions and 0 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue