Make sure that we have a stream

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-02-18 14:25:57 +01:00
parent 3edffdd581
commit fc967a5ac2
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 7 additions and 0 deletions

View File

@ -167,6 +167,13 @@ class File extends Node implements IFile {
}
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
if (!is_resource($data)) {
$data = fopen('php://temp', 'r+');
fwrite($data, 'foobar');
rewind($data);
}
$isEOF = false;
$wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) {
$isEOF = feof($stream);