]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update icewind/streams to 0.7.7, and remove it from explicit deps in files_external
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 11 May 2023 10:05:12 +0000 (12:05 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 11 May 2023 10:05:12 +0000 (12:05 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
15 files changed:
apps/files_external/3rdparty/autoload.php
apps/files_external/3rdparty/composer.json
apps/files_external/3rdparty/composer.lock
apps/files_external/3rdparty/composer/ClassLoader.php
apps/files_external/3rdparty/composer/InstalledVersions.php
apps/files_external/3rdparty/composer/installed.json
apps/files_external/3rdparty/composer/installed.php
apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php
apps/files_external/3rdparty/icewind/streams/src/CountWrapper.php
apps/files_external/3rdparty/icewind/streams/src/DirectoryFilter.php
apps/files_external/3rdparty/icewind/streams/src/DirectoryWrapper.php
apps/files_external/3rdparty/icewind/streams/src/HashWrapper.php
apps/files_external/3rdparty/icewind/streams/src/IteratorDirectory.php
apps/files_external/3rdparty/icewind/streams/src/Wrapper.php
apps/files_external/3rdparty/icewind/streams/src/WrapperHandler.php

index 28026e9da6b12512271707f8d2226be0ae2f656b..d3359ad45d9a84cfdbf09a8e8d3bdcee00f79974 100644 (file)
@@ -3,8 +3,21 @@
 // autoload.php @generated by Composer
 
 if (PHP_VERSION_ID < 50600) {
-    echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
-    exit(1);
+    if (!headers_sent()) {
+        header('HTTP/1.1 500 Internal Server Error');
+    }
+    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
+    if (!ini_get('display_errors')) {
+        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+            fwrite(STDERR, $err);
+        } elseif (!headers_sent()) {
+            echo $err;
+        }
+    }
+    trigger_error(
+        $err,
+        E_USER_ERROR
+    );
 }
 
 require_once __DIR__ . '/composer/autoload_real.php';
index ff102e7c3ec3f8d7b43dfa39882e031f79a721c0..9566f4633204b295e91b37e5223a2155be4484cf 100644 (file)
@@ -8,7 +8,6 @@
                "classmap-authoritative": true
        },
        "require": {
-               "icewind/streams": "0.7.4",
                "icewind/smb": "3.5.4"
        }
 }
index a9b699e2c557602e6236e0642fcb1123e1a0ec06..281fdef3e234d26c267179238fd736877862f762 100644 (file)
@@ -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": "5d34e39627716fec1b5b11ab6a667e53",
+    "content-hash": "1419e286d2372dfbce44dd73ddbab2ff",
     "packages": [
         {
             "name": "icewind/smb",
         },
         {
             "name": "icewind/streams",
-            "version": "v0.7.4",
+            "version": "v0.7.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/icewind1991/Streams.git",
-                "reference": "93bce472202d36d9808c30eaa52a1dc72b39e04c"
+                "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/icewind1991/Streams/zipball/93bce472202d36d9808c30eaa52a1dc72b39e04c",
-                "reference": "93bce472202d36d9808c30eaa52a1dc72b39e04c",
+                "url": "https://api.github.com/repos/icewind1991/Streams/zipball/64200fd7cfcc7f550c3c695c48d8fd8bba97fecb",
+                "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb",
                 "shasum": ""
             },
             "require": {
@@ -94,9 +94,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.4"
+                "source": "https://github.com/icewind1991/Streams/tree/v0.7.7"
             },
-            "time": "2021-03-12T15:48:22+00:00"
+            "time": "2023-03-16T14:52:25+00:00"
         }
     ],
     "packages-dev": [],
index afef3fa2ad83f114c8de5487e869f9c9b8a459bf..a72151c77c8eb0c43635bfb2ac1ca2d834ac01a7 100644 (file)
@@ -42,6 +42,9 @@ namespace Composer\Autoload;
  */
 class ClassLoader
 {
+    /** @var \Closure(string):void */
+    private static $includeFile;
+
     /** @var ?string */
     private $vendorDir;
 
@@ -106,6 +109,7 @@ class ClassLoader
     public function __construct($vendorDir = null)
     {
         $this->vendorDir = $vendorDir;
+        self::initializeIncludeClosure();
     }
 
     /**
@@ -425,7 +429,8 @@ class ClassLoader
     public function loadClass($class)
     {
         if ($file = $this->findFile($class)) {
-            includeFile($file);
+            $includeFile = self::$includeFile;
+            $includeFile($file);
 
             return true;
         }
@@ -555,18 +560,26 @@ class ClassLoader
 
         return false;
     }
-}
 
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param  string $file
- * @return void
- * @private
- */
-function includeFile($file)
-{
-    include $file;
+    /**
+     * @return void
+     */
+    private static function initializeIncludeClosure()
+    {
+        if (self::$includeFile !== null) {
+            return;
+        }
+
+        /**
+         * Scope isolated include.
+         *
+         * Prevents access to $this/self from included files.
+         *
+         * @param  string $file
+         * @return void
+         */
+        self::$includeFile = \Closure::bind(static function($file) {
+            include $file;
+        }, null, null);
+    }
 }
index 41bc143c11489e9cc3e2138f7e32d4ea1f986ba1..51e734a774b3ed9ca110a921cb40a74f8c7905c2 100644 (file)
@@ -28,7 +28,7 @@ class InstalledVersions
 {
     /**
      * @var mixed[]|null
-     * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
+     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
      */
     private static $installed;
 
@@ -39,7 +39,7 @@ class InstalledVersions
 
     /**
      * @var array[]
-     * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
+     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
      */
     private static $installedByVendor = array();
 
@@ -98,7 +98,7 @@ class InstalledVersions
     {
         foreach (self::getInstalled() as $installed) {
             if (isset($installed['versions'][$packageName])) {
-                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
+                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
             }
         }
 
@@ -119,7 +119,7 @@ class InstalledVersions
      */
     public static function satisfies(VersionParser $parser, $packageName, $constraint)
     {
-        $constraint = $parser->parseConstraints($constraint);
+        $constraint = $parser->parseConstraints((string) $constraint);
         $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
 
         return $provided->matches($constraint);
@@ -243,7 +243,7 @@ class InstalledVersions
 
     /**
      * @return array
-     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
+     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
      */
     public static function getRootPackage()
     {
@@ -257,7 +257,7 @@ class InstalledVersions
      *
      * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
      * @return array[]
-     * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
+     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
      */
     public static function getRawData()
     {
@@ -280,7 +280,7 @@ class InstalledVersions
      * Returns the raw data of all installed.php which are currently loaded for custom implementations
      *
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
+     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
      */
     public static function getAllRawData()
     {
@@ -303,7 +303,7 @@ class InstalledVersions
      * @param  array[] $data A vendor/composer/installed.php data set
      * @return void
      *
-     * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
+     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
      */
     public static function reload($data)
     {
@@ -313,7 +313,7 @@ class InstalledVersions
 
     /**
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
+     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
      */
     private static function getInstalled()
     {
@@ -328,7 +328,9 @@ class InstalledVersions
                 if (isset(self::$installedByVendor[$vendorDir])) {
                     $installed[] = self::$installedByVendor[$vendorDir];
                 } elseif (is_file($vendorDir.'/composer/installed.php')) {
-                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
+                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
+                    $required = require $vendorDir.'/composer/installed.php';
+                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
                         self::$installed = $installed[count($installed) - 1];
                     }
@@ -340,12 +342,17 @@ class InstalledVersions
             // only require the installed.php file if this file is loaded from its dumped location,
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
             if (substr(__DIR__, -8, 1) !== 'C') {
-                self::$installed = require __DIR__ . '/installed.php';
+                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
+                $required = require __DIR__ . '/installed.php';
+                self::$installed = $required;
             } else {
                 self::$installed = array();
             }
         }
-        $installed[] = self::$installed;
+
+        if (self::$installed !== array()) {
+            $installed[] = self::$installed;
+        }
 
         return $installed;
     }
index bc6cdb8e6c97460fd26590a3954f6f75643edd7c..9b66e6497158cf1feede31e08ffe91c08aade347 100644 (file)
         },
         {
             "name": "icewind/streams",
-            "version": "v0.7.4",
-            "version_normalized": "0.7.4.0",
+            "version": "v0.7.7",
+            "version_normalized": "0.7.7.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/icewind1991/Streams.git",
-                "reference": "93bce472202d36d9808c30eaa52a1dc72b39e04c"
+                "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/icewind1991/Streams/zipball/93bce472202d36d9808c30eaa52a1dc72b39e04c",
-                "reference": "93bce472202d36d9808c30eaa52a1dc72b39e04c",
+                "url": "https://api.github.com/repos/icewind1991/Streams/zipball/64200fd7cfcc7f550c3c695c48d8fd8bba97fecb",
+                "reference": "64200fd7cfcc7f550c3c695c48d8fd8bba97fecb",
                 "shasum": ""
             },
             "require": {
@@ -73,7 +73,7 @@
                 "phpstan/phpstan": "^0.12",
                 "phpunit/phpunit": "^9"
             },
-            "time": "2021-03-12T15:48:22+00:00",
+            "time": "2023-03-16T14:52:25+00:00",
             "type": "library",
             "installation-source": "dist",
             "autoload": {
@@ -94,7 +94,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.4"
+                "source": "https://github.com/icewind1991/Streams/tree/v0.7.7"
             },
             "install-path": "../icewind/streams"
         }
index 1adf5df7db3b06f0146e7601e73e6b3d3dbfb96a..65684203f3f4f33c872817644225fa125e5141fd 100644 (file)
@@ -1,40 +1,40 @@
 <?php return array(
     'root' => array(
+        'name' => 'files_external/3rdparty',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
+        'reference' => '979f4033ca1cd0be7f255f028d4cc637a216440d',
         'type' => 'library',
         'install_path' => __DIR__ . '/../',
         'aliases' => array(),
-        'reference' => '15d43dcc6226b92c0d51d643ef8c5ab1339cae48',
-        'name' => 'files_external/3rdparty',
         'dev' => true,
     ),
     'versions' => array(
         'files_external/3rdparty' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
+            'reference' => '979f4033ca1cd0be7f255f028d4cc637a216440d',
             'type' => 'library',
             'install_path' => __DIR__ . '/../',
             'aliases' => array(),
-            'reference' => '15d43dcc6226b92c0d51d643ef8c5ab1339cae48',
             'dev_requirement' => false,
         ),
         'icewind/smb' => array(
             'pretty_version' => 'v3.5.4',
             'version' => '3.5.4.0',
+            'reference' => '76995aa11c14e39bccd0f2370ed63b2f8f623a6d',
             'type' => 'library',
             'install_path' => __DIR__ . '/../icewind/smb',
             'aliases' => array(),
-            'reference' => '76995aa11c14e39bccd0f2370ed63b2f8f623a6d',
             'dev_requirement' => false,
         ),
         'icewind/streams' => array(
-            'pretty_version' => 'v0.7.4',
-            'version' => '0.7.4.0',
+            'pretty_version' => 'v0.7.7',
+            'version' => '0.7.7.0',
+            'reference' => '64200fd7cfcc7f550c3c695c48d8fd8bba97fecb',
             'type' => 'library',
             'install_path' => __DIR__ . '/../icewind/streams',
             'aliases' => array(),
-            'reference' => '93bce472202d36d9808c30eaa52a1dc72b39e04c',
             'dev_requirement' => false,
         ),
     ),
index 5d78b5a3db0b17fd0c6a6f12c026139d1e9fd4bb..bc5e4356cdaa7fa173517014d815957ae9b0de4e 100644 (file)
@@ -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) {
index b3346209aedd2cd359347fbf9d317cb7d77cd157..d5aee9c9c4b195856ba60d2167d740edb0235de7 100644 (file)
@@ -55,7 +55,7 @@ class CountWrapper extends Wrapper {
         *
         * @param resource $source
         * @param callable $callback
-        * @return resource|bool
+        * @return resource|false
         *
         * @throws \BadMethodCallException
         */
index 80b27e8bab85897f8a8d99e71462a4c34fb147c4..6a896c04b086918301917f326c74bc22bb1b16c6 100644 (file)
@@ -46,7 +46,7 @@ class DirectoryFilter extends DirectoryWrapper {
        /**
         * @param resource $source
         * @param callable $filter
-        * @return resource|bool
+        * @return resource|false
         */
        public static function wrap($source, callable $filter) {
                return self::wrapSource($source, [
index 7f2f5c291c6adbbcf896d8975b78b4977a245dc9..ff47096d2d7397dcb064a2202a547abff18dbb71 100644 (file)
@@ -23,7 +23,7 @@ class DirectoryWrapper extends Wrapper implements Directory {
        }
 
        /**
-        * @return string
+        * @return string|false
         */
        public function dir_readdir() {
                return readdir($this->source);
index 616c2fe506f9084a457c9f5b91d49d2410ead895..5e0163092e8b160cf6bcd8fad3634763b245e133 100644 (file)
@@ -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
         */
index a3872ddf474dc764808a2c1e3c61b5391ea70189..7c6bd515c1ef26a101d0aecdc1723845134cfd5e 100644 (file)
@@ -92,7 +92,7 @@ class IteratorDirectory extends WrapperHandler implements Directory {
         * Creates a directory handle from the provided array or iterator
         *
         * @param \Iterator | array $source
-        * @return resource|bool
+        * @return resource|false
         *
         * @throws \BadMethodCallException
         */
index 03d0b202571835b23ca042d8e88d9a29866c5f25..5b6348afe4faa677846bff7468406008594f3d44 100644 (file)
@@ -44,7 +44,7 @@ abstract class Wrapper extends WrapperHandler implements File, Directory {
 
        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 @@ abstract class Wrapper extends WrapperHandler implements File, Directory {
        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;
+       }
 }
index 52a02feb19f9435fdea4b7ba24e2a18d5f8424f0..be408807ed3565ba866eae190b65ae2703ad1c09 100644 (file)
@@ -55,9 +55,9 @@ class WrapperHandler {
         * @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) {
+       protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') {
                if ($class === null) {
                        $class = static::class;
                }
@@ -72,7 +72,7 @@ class WrapperHandler {
                        if (self::isDirectoryHandle($source)) {
                                return opendir($protocol . '://', $context);
                        } else {
-                               return fopen($protocol . '://', 'r+', false, $context);
+                               return fopen($protocol . '://', $mode, false, $context);
                        }
                } finally {
                        stream_wrapper_unregister($protocol);