diff options
Diffstat (limited to 'apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php')
-rw-r--r-- | apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php index d41fd73ec9c..f131e75308e 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/SeekableWrapper.php @@ -25,21 +25,8 @@ class SeekableWrapper extends Wrapper { */ protected $cache; - /** - * Wraps a stream to make it seekable - * - * @param resource $source - * @return resource - * - * @throws \BadMethodCallException - */ public static function wrap($source) { - $context = stream_context_create(array( - 'callback' => array( - 'source' => $source - ) - )); - return Wrapper::wrapSource($source, $context, 'callback', '\Icewind\Streams\SeekableWrapper'); + return self::wrapSource($source); } public function dir_opendir($path, $options) { @@ -47,8 +34,12 @@ class SeekableWrapper extends Wrapper { } public function stream_open($path, $mode, $options, &$opened_path) { - $this->loadContext('callback'); - $this->cache = fopen('php://temp', 'w+'); + $this->loadContext(); + $cache = fopen('php://temp', 'w+'); + if ($cache === false) { + return false; + } + $this->cache = $cache; return true; } @@ -72,7 +63,7 @@ class SeekableWrapper extends Wrapper { public function stream_seek($offset, $whence = SEEK_SET) { if ($whence === SEEK_SET) { $target = $offset; - } else if ($whence === SEEK_CUR) { + } elseif ($whence === SEEK_CUR) { $current = ftell($this->cache); $target = $current + $offset; } else { |