diff --git a/composer.json b/composer.json index 8a14d570b..8e7999921 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "giggsey/libphonenumber-for-php": "^8.12.37", "guzzlehttp/guzzle": "^7.5.0", "icewind/searchdav": "^3.0", - "icewind/streams": "v0.7.5", + "icewind/streams": "^0.7.7", "laravel/serializable-closure": "^1.2.2", "mexitek/phpcolors": "^1.0", "microsoft/azure-storage-blob": "^1.5.4", diff --git a/composer.lock b/composer.lock index fbb79dd10..b87e4b1d7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "734ce02a770960178c3a2ffb071546ce", + "content-hash": "9222af167b131326d41c1eef936e1094", "packages": [ { "name": "aws/aws-crt-php", @@ -1737,16 +1737,16 @@ }, { "name": "icewind/streams", - "version": "v0.7.5", + "version": "v0.7.7", "source": { "type": "git", "url": "https://github.com/icewind1991/Streams.git", - "reference": "0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2" + "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2", - "reference": "0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2", + "url": "https://api.github.com/repos/icewind1991/Streams/zipball/64200fd7cfcc7f550c3c695c48d8fd8bba97fecb", + "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb", "shasum": "" }, "require": { @@ -1776,9 +1776,9 @@ "description": "A set of generic stream wrappers", "support": { "issues": "https://github.com/icewind1991/Streams/issues", - "source": "https://github.com/icewind1991/Streams/tree/v0.7.5" + "source": "https://github.com/icewind1991/Streams/tree/v0.7.7" }, - "time": "2021-06-14T14:02:48+00:00" + "time": "2023-03-16T14:52:25+00:00" }, { "name": "justinrainbow/json-schema", diff --git a/composer/installed.json b/composer/installed.json index e5b567244..ec479cd18 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -1806,17 +1806,17 @@ }, { "name": "icewind/streams", - "version": "v0.7.5", - "version_normalized": "0.7.5.0", + "version": "v0.7.7", + "version_normalized": "0.7.7.0", "source": { "type": "git", "url": "https://github.com/icewind1991/Streams.git", - "reference": "0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2" + "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/Streams/zipball/0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2", - "reference": "0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2", + "url": "https://api.github.com/repos/icewind1991/Streams/zipball/64200fd7cfcc7f550c3c695c48d8fd8bba97fecb", + "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb", "shasum": "" }, "require": { @@ -1827,7 +1827,7 @@ "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^9" }, - "time": "2021-06-14T14:02:48+00:00", + "time": "2023-03-16T14:52:25+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1848,7 +1848,7 @@ "description": "A set of generic stream wrappers", "support": { "issues": "https://github.com/icewind1991/Streams/issues", - "source": "https://github.com/icewind1991/Streams/tree/v0.7.5" + "source": "https://github.com/icewind1991/Streams/tree/v0.7.7" }, "install-path": "../icewind/streams" }, diff --git a/composer/installed.php b/composer/installed.php index 361bbd4b7..371505c82 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0eb92e4624ac87a31a767628853dca656e99db17', + 'reference' => '95330ecbe44f864edd0d193f249ca2acc84d9d06', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -236,9 +236,9 @@ 'dev_requirement' => false, ), 'icewind/streams' => array( - 'pretty_version' => 'v0.7.5', - 'version' => '0.7.5.0', - 'reference' => '0c6aae16ebdadb257f0bd089c1e1e4cf5e20ddc2', + 'pretty_version' => 'v0.7.7', + 'version' => '0.7.7.0', + 'reference' => '64200fd7cfcc7f550c3c695c48d8fd8bba97fecb', 'type' => 'library', 'install_path' => __DIR__ . '/../icewind/streams', 'aliases' => array(), @@ -328,7 +328,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0eb92e4624ac87a31a767628853dca656e99db17', + 'reference' => '95330ecbe44f864edd0d193f249ca2acc84d9d06', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), diff --git a/icewind/streams/src/CallbackWrapper.php b/icewind/streams/src/CallbackWrapper.php index 5d78b5a3d..bc5e4356c 100644 --- a/icewind/streams/src/CallbackWrapper.php +++ b/icewind/streams/src/CallbackWrapper.php @@ -58,7 +58,7 @@ class CallbackWrapper extends Wrapper { * @param callable|null $close (optional) * @param callable|null $readDir (optional) * @param callable|null $preClose (optional) - * @return resource|bool + * @return resource|false * */ public static function wrap($source, $read = null, $write = null, $close = null, $readDir = null, $preClose = null) { diff --git a/icewind/streams/src/CountWrapper.php b/icewind/streams/src/CountWrapper.php index b3346209a..d5aee9c9c 100644 --- a/icewind/streams/src/CountWrapper.php +++ b/icewind/streams/src/CountWrapper.php @@ -55,7 +55,7 @@ class CountWrapper extends Wrapper { * * @param resource $source * @param callable $callback - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/icewind/streams/src/DirectoryFilter.php b/icewind/streams/src/DirectoryFilter.php index 80b27e8ba..6a896c04b 100644 --- a/icewind/streams/src/DirectoryFilter.php +++ b/icewind/streams/src/DirectoryFilter.php @@ -46,7 +46,7 @@ public function dir_readdir() { /** * @param resource $source * @param callable $filter - * @return resource|bool + * @return resource|false */ public static function wrap($source, callable $filter) { return self::wrapSource($source, [ diff --git a/icewind/streams/src/DirectoryWrapper.php b/icewind/streams/src/DirectoryWrapper.php index 7f2f5c291..ff47096d2 100644 --- a/icewind/streams/src/DirectoryWrapper.php +++ b/icewind/streams/src/DirectoryWrapper.php @@ -23,7 +23,7 @@ public function dir_opendir($path, $options) { } /** - * @return string + * @return string|false */ public function dir_readdir() { return readdir($this->source); diff --git a/icewind/streams/src/HashWrapper.php b/icewind/streams/src/HashWrapper.php index 616c2fe50..5e0163092 100644 --- a/icewind/streams/src/HashWrapper.php +++ b/icewind/streams/src/HashWrapper.php @@ -41,7 +41,7 @@ abstract class HashWrapper extends Wrapper { * @param resource $source * @param string $hash * @param callable $callback - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/icewind/streams/src/IteratorDirectory.php b/icewind/streams/src/IteratorDirectory.php index a3872ddf4..7c6bd515c 100644 --- a/icewind/streams/src/IteratorDirectory.php +++ b/icewind/streams/src/IteratorDirectory.php @@ -92,7 +92,7 @@ public function dir_rewinddir() { * Creates a directory handle from the provided array or iterator * * @param \Iterator | array $source - * @return resource|bool + * @return resource|false * * @throws \BadMethodCallException */ diff --git a/icewind/streams/src/Wrapper.php b/icewind/streams/src/Wrapper.php index 03d0b2025..5b6348afe 100644 --- a/icewind/streams/src/Wrapper.php +++ b/icewind/streams/src/Wrapper.php @@ -44,7 +44,7 @@ protected function loadContext($name = null) { public function stream_seek($offset, $whence = SEEK_SET) { $result = fseek($this->source, $offset, $whence); - return $result == 0 ? true : false; + return $result == 0; } public function stream_tell() { @@ -109,4 +109,23 @@ public function dir_closedir() { public function dir_rewinddir() { return rewind($this->source); } + + public function getSource() { + return $this->source; + } + + /** + * Retrieves header/metadata from the source stream. + * + * This is equivalent to calling `stream_get_meta_data` on the source stream except nested stream wrappers are handled transparently + * + * @return array + */ + public function getMetaData(): array { + $meta = stream_get_meta_data($this->source); + while (isset($meta['wrapper_data']) && $meta['wrapper_data'] instanceof Wrapper) { + $meta = $meta['wrapper_data']->getMetaData(); + } + return $meta; + } } diff --git a/icewind/streams/src/WrapperHandler.php b/icewind/streams/src/WrapperHandler.php index 258e3ec83..be408807e 100644 --- a/icewind/streams/src/WrapperHandler.php +++ b/icewind/streams/src/WrapperHandler.php @@ -55,7 +55,7 @@ private static function buildContext($protocol, $context, $source) { * @param resource|array $context * @param string|null $protocol deprecated, protocol is now automatically generated * @param string|null $class deprecated, class is now automatically generated - * @return bool|resource + * @return resource|false */ protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') { if ($class === null) {