From 1370d7d39d9e01a0e88dfdd1c4c7fca629cad282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 3 Aug 2023 19:22:10 +0200 Subject: [PATCH] Update composer dependencies --- .../files/lib/system/api/composer.json | 2 +- .../files/lib/system/api/composer.lock | 26 ++++---- .../lib/system/api/composer/installed.json | 28 ++++----- .../lib/system/api/composer/installed.php | 20 +++---- .../api/guzzlehttp/promises/CHANGELOG.md | 9 ++- .../system/api/guzzlehttp/promises/README.md | 2 +- .../promises/src/RejectionException.php | 2 +- .../vendor-bin/php-cs-fixer/composer.json | 9 --- .../promises/vendor-bin/phpstan/composer.json | 10 ---- .../promises/vendor-bin/psalm/composer.json | 9 --- .../system/api/guzzlehttp/psr7/CHANGELOG.md | 17 +++++- .../lib/system/api/guzzlehttp/psr7/README.md | 24 ++++---- .../api/guzzlehttp/psr7/src/AppendStream.php | 6 +- .../api/guzzlehttp/psr7/src/FnStream.php | 7 ++- .../system/api/guzzlehttp/psr7/src/Header.php | 2 +- .../api/guzzlehttp/psr7/src/HttpFactory.php | 8 +-- .../api/guzzlehttp/psr7/src/InflateStream.php | 6 +- .../api/guzzlehttp/psr7/src/Message.php | 24 ++++---- .../api/guzzlehttp/psr7/src/MessageTrait.php | 8 ++- .../api/guzzlehttp/psr7/src/MimeType.php | 34 +++++++++-- .../guzzlehttp/psr7/src/MultipartStream.php | 8 +-- .../api/guzzlehttp/psr7/src/PumpStream.php | 2 + .../system/api/guzzlehttp/psr7/src/Query.php | 4 +- .../api/guzzlehttp/psr7/src/Request.php | 6 +- .../api/guzzlehttp/psr7/src/Response.php | 1 + .../api/guzzlehttp/psr7/src/Rfc7230.php | 2 +- .../api/guzzlehttp/psr7/src/ServerRequest.php | 10 ++-- .../system/api/guzzlehttp/psr7/src/Stream.php | 9 ++- .../psr7/src/StreamDecoratorTrait.php | 3 + .../api/guzzlehttp/psr7/src/StreamWrapper.php | 60 +++++++++---------- .../system/api/guzzlehttp/psr7/src/Uri.php | 51 ++++++++-------- .../api/guzzlehttp/psr7/src/UriNormalizer.php | 6 +- .../api/guzzlehttp/psr7/src/UriResolver.php | 14 ++--- .../system/api/guzzlehttp/psr7/src/Utils.php | 8 ++- 34 files changed, 233 insertions(+), 204 deletions(-) delete mode 100644 wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json delete mode 100644 wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/phpstan/composer.json delete mode 100644 wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/psalm/composer.json diff --git a/wcfsetup/install/files/lib/system/api/composer.json b/wcfsetup/install/files/lib/system/api/composer.json index 731183b6cea..0554681b257 100644 --- a/wcfsetup/install/files/lib/system/api/composer.json +++ b/wcfsetup/install/files/lib/system/api/composer.json @@ -15,7 +15,7 @@ "erusev/parsedown": "^1.7.4", "ezyang/htmlpurifier": "^4.16", "guzzlehttp/guzzle": "^7.7.0", - "guzzlehttp/psr7": "^2.5.0", + "guzzlehttp/psr7": "^2.6.0", "laminas/laminas-diactoros": "^3.1.0", "laminas/laminas-httphandlerrunner": "^2.7.0", "laminas/laminas-progressbar": "^2.12", diff --git a/wcfsetup/install/files/lib/system/api/composer.lock b/wcfsetup/install/files/lib/system/api/composer.lock index 7a9f744029f..3a8385d04b3 100644 --- a/wcfsetup/install/files/lib/system/api/composer.lock +++ b/wcfsetup/install/files/lib/system/api/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": "f22e1ed8363f1981362682c58a866a8a", + "content-hash": "d94553c231572f020140e0c1ed535635", "packages": [ { "name": "cuyz/valinor", @@ -379,16 +379,16 @@ }, { "name": "guzzlehttp/promises", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", "shasum": "" }, "require": { @@ -442,7 +442,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.0" + "source": "https://github.com/guzzle/promises/tree/2.0.1" }, "funding": [ { @@ -458,20 +458,20 @@ "type": "tidelift" } ], - "time": "2023-05-21T13:50:22+00:00" + "time": "2023-08-03T15:11:55+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", "shasum": "" }, "require": { @@ -558,7 +558,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.5.0" + "source": "https://github.com/guzzle/psr7/tree/2.6.0" }, "funding": [ { @@ -574,7 +574,7 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:11:26+00:00" + "time": "2023-08-03T15:06:02+00:00" }, { "name": "laminas/laminas-diactoros", diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.json b/wcfsetup/install/files/lib/system/api/composer/installed.json index f9c86fcc624..989b93522e3 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.json +++ b/wcfsetup/install/files/lib/system/api/composer/installed.json @@ -388,17 +388,17 @@ }, { "name": "guzzlehttp/promises", - "version": "2.0.0", - "version_normalized": "2.0.0.0", + "version": "2.0.1", + "version_normalized": "2.0.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", - "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", "shasum": "" }, "require": { @@ -408,7 +408,7 @@ "bamarni/composer-bin-plugin": "^1.8.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, - "time": "2023-05-21T13:50:22+00:00", + "time": "2023-08-03T15:11:55+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -454,7 +454,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.0" + "source": "https://github.com/guzzle/promises/tree/2.0.1" }, "funding": [ { @@ -474,17 +474,17 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.5.0", - "version_normalized": "2.5.0.0", + "version": "2.6.0", + "version_normalized": "2.6.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", "shasum": "" }, "require": { @@ -505,7 +505,7 @@ "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2023-04-17T16:11:26+00:00", + "time": "2023-08-03T15:06:02+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -573,7 +573,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.5.0" + "source": "https://github.com/guzzle/psr7/tree/2.6.0" }, "funding": [ { diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.php b/wcfsetup/install/files/lib/system/api/composer/installed.php index 1a018e70056..ffe1d47fd32 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.php +++ b/wcfsetup/install/files/lib/system/api/composer/installed.php @@ -65,18 +65,18 @@ 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '2.0.0', - 'version' => '2.0.0.0', - 'reference' => '3a494dc7dc1d7d12e511890177ae2d0e6c107da6', + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'reference' => '111166291a0f8130081195ac4556a5587d7f1b5d', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.5.0', - 'version' => '2.5.0.0', - 'reference' => 'b635f279edd83fc275f822a1188157ffea568ff6', + 'pretty_version' => '2.6.0', + 'version' => '2.6.0.0', + 'reference' => '8bd7c33a0734ae1c5d074360512beb716bef3f77', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -187,8 +187,8 @@ 'psr/http-factory-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', - 1 => '^1.1 || ^2.0', + 0 => '^1.1 || ^2.0', + 1 => '1.0', ), ), 'psr/http-message' => array( @@ -203,8 +203,8 @@ 'psr/http-message-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', - 1 => '^1.1 || ^2.0', + 0 => '^1.1 || ^2.0', + 1 => '1.0', ), ), 'psr/http-server-handler' => array( diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/CHANGELOG.md b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/CHANGELOG.md index ab173ad7498..eaf2af426f9 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/CHANGELOG.md +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/CHANGELOG.md @@ -1,7 +1,14 @@ # CHANGELOG -## 2.0.0 - TBC +## 2.0.1 - 2023-08-03 + +### Changed + +- PHP 8.3 support + + +## 2.0.0 - 2023-05-21 ### Added diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/README.md b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/README.md index 4dc7b6a1dc2..a32d3d29c79 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/README.md +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/README.md @@ -41,7 +41,7 @@ composer require guzzlehttp/promises | Version | Status | PHP Version | |---------|------------------------|--------------| | 1.x | Bug and security fixes | >=5.5,<8.3 | -| 2.x | Latest | >=7.2.5,<8.3 | +| 2.x | Latest | >=7.2.5,<8.4 | ## Quick Start diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/src/RejectionException.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/src/RejectionException.php index 0db98ffb9ae..47dca862486 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/src/RejectionException.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/src/RejectionException.php @@ -18,7 +18,7 @@ class RejectionException extends \RuntimeException * @param mixed $reason Rejection reason. * @param string|null $description Optional description. */ - public function __construct($reason, $description = null) + public function __construct($reason, ?string $description = null) { $this->reason = $reason; diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json deleted file mode 100644 index c9dd5ee427f..00000000000 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/php-cs-fixer/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "require": { - "php": "^7.4 || ^8.0", - "friendsofphp/php-cs-fixer": "3.16.0" - }, - "config": { - "preferred-install": "dist" - } -} diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/phpstan/composer.json b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/phpstan/composer.json deleted file mode 100644 index 711507cba8e..00000000000 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/phpstan/composer.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "require": { - "php": "^7.4 || ^8.0", - "phpstan/phpstan": "1.10.11", - "phpstan/phpstan-deprecation-rules": "1.1.3" - }, - "config": { - "preferred-install": "dist" - } -} diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/psalm/composer.json b/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/psalm/composer.json deleted file mode 100644 index ab96f2caf77..00000000000 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/promises/vendor-bin/psalm/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "require": { - "php": "^7.4 || ^8.0", - "psalm/phar": "5.9.0" - }, - "config": { - "preferred-install": "dist" - } -} diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/CHANGELOG.md b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/CHANGELOG.md index fa716c094b8..e841f67ff71 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/CHANGELOG.md +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/CHANGELOG.md @@ -5,7 +5,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 2.6.0 - 2023-08-03 + +### Changed + +- Updated the mime type map to add some new entries, fix a couple of invalid entries, and remove an invalid entry +- Fallback to `application/octet-stream` if we are unable to guess the content type for a multipart file upload + +## 2.5.1 - 2023-08-03 + +### Fixed + +- Corrected mime type for `.acc` files to `audio/aac` + +### Changed + +- PHP 8.3 support ## 2.5.0 - 2023-04-17 diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/README.md b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/README.md index 9566a7d4720..a64ec904619 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/README.md +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/README.md @@ -8,16 +8,24 @@ functionality like query string parsing. ![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg) -# Installation +## Features + +This package comes with a number of stream implementations and stream +decorators. + + +## Installation ```shell composer require guzzlehttp/psr7 ``` -# Stream implementation +## Version Guidance -This package comes with a number of stream implementations and stream -decorators. +| Version | Status | PHP Version | +|---------|---------------------|--------------| +| 1.x | Security fixes only | >=5.4,<8.1 | +| 2.x | Latest | >=7.2.5,<8.4 | ## AppendStream @@ -855,14 +863,6 @@ This of course assumes they will be resolved against the same base URI. If this equivalence or difference of relative references does not mean anything. -## Version Guidance - -| Version | Status | PHP Version | -|---------|----------------|------------------| -| 1.x | Security fixes | >=5.4,<8.1 | -| 2.x | Latest | ^7.2.5 \|\| ^8.0 | - - ## Security If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/AppendStream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/AppendStream.php index cbcfaee65d2..8361564b0d0 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/AppendStream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/AppendStream.php @@ -40,12 +40,14 @@ public function __toString(): string { try { $this->rewind(); + return $this->getContents(); } catch (\Throwable $e) { if (\PHP_VERSION_ID >= 70400) { throw $e; } trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; } } @@ -167,7 +169,7 @@ public function seek($offset, $whence = SEEK_SET): void $stream->rewind(); } catch (\Exception $e) { throw new \RuntimeException('Unable to seek stream ' - . $i . ' of the AppendStream', 0, $e); + .$i.' of the AppendStream', 0, $e); } } @@ -197,7 +199,7 @@ public function read($length): string if ($this->current === $total) { break; } - $this->current++; + ++$this->current; } $result = $this->streams[$this->current]->read($remaining); diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/FnStream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/FnStream.php index 3a1a9512e5d..312b80ec700 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/FnStream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/FnStream.php @@ -18,7 +18,7 @@ final class FnStream implements StreamInterface private const SLOTS = [ '__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', - 'isReadable', 'read', 'getContents', 'getMetadata' + 'isReadable', 'read', 'getContents', 'getMetadata', ]; /** @var array */ @@ -33,7 +33,7 @@ public function __construct(array $methods) // Create the functions on the class foreach ($methods as $name => $fn) { - $this->{'_fn_' . $name} = $fn; + $this->{'_fn_'.$name} = $fn; } } @@ -45,7 +45,7 @@ public function __construct(array $methods) public function __get(string $name): void { throw new \BadMethodCallException(str_replace('_fn_', '', $name) - . '() is not implemented in the FnStream'); + .'() is not implemented in the FnStream'); } /** @@ -99,6 +99,7 @@ public function __toString(): string throw $e; } trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; } } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Header.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Header.php index 4d7005b2248..6e38e003128 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Header.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Header.php @@ -89,7 +89,7 @@ public static function splitList($values): array $v = ''; $isQuoted = false; $isEscaped = false; - for ($i = 0, $max = \strlen($value); $i < $max; $i++) { + for ($i = 0, $max = \strlen($value); $i < $max; ++$i) { if ($isEscaped) { $v .= $value[$i]; $isEscaped = false; diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/HttpFactory.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/HttpFactory.php index 30be222fc0b..73d17e33788 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/HttpFactory.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/HttpFactory.php @@ -23,13 +23,7 @@ * Note: in consuming code it is recommended to require the implemented interfaces * and inject the instance of this class multiple times. */ -final class HttpFactory implements - RequestFactoryInterface, - ResponseFactoryInterface, - ServerRequestFactoryInterface, - StreamFactoryInterface, - UploadedFileFactoryInterface, - UriFactoryInterface +final class HttpFactory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface { public function createUploadedFile( StreamInterface $stream, diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/InflateStream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/InflateStream.php index 8e00f1c324d..599b55da3fe 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/InflateStream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/InflateStream.php @@ -13,9 +13,9 @@ * then appends the zlib.inflate filter. The stream is then converted back * to a Guzzle stream resource to be used as a Guzzle stream. * - * @link http://tools.ietf.org/html/rfc1950 - * @link http://tools.ietf.org/html/rfc1952 - * @link http://php.net/manual/en/filters.compression.php + * @see http://tools.ietf.org/html/rfc1950 + * @see http://tools.ietf.org/html/rfc1952 + * @see http://php.net/manual/en/filters.compression.php */ final class InflateStream implements StreamInterface { diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Message.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Message.php index c1e15f8267a..9b74b8d46f7 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Message.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Message.php @@ -18,16 +18,16 @@ final class Message public static function toString(MessageInterface $message): string { if ($message instanceof RequestInterface) { - $msg = trim($message->getMethod() . ' ' - . $message->getRequestTarget()) - . ' HTTP/' . $message->getProtocolVersion(); + $msg = trim($message->getMethod().' ' + .$message->getRequestTarget()) + .' HTTP/'.$message->getProtocolVersion(); if (!$message->hasHeader('host')) { - $msg .= "\r\nHost: " . $message->getUri()->getHost(); + $msg .= "\r\nHost: ".$message->getUri()->getHost(); } } elseif ($message instanceof ResponseInterface) { - $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' - . $message->getStatusCode() . ' ' - . $message->getReasonPhrase(); + $msg = 'HTTP/'.$message->getProtocolVersion().' ' + .$message->getStatusCode().' ' + .$message->getReasonPhrase(); } else { throw new \InvalidArgumentException('Unknown message type'); } @@ -35,14 +35,14 @@ public static function toString(MessageInterface $message): string foreach ($message->getHeaders() as $name => $values) { if (strtolower($name) === 'set-cookie') { foreach ($values as $value) { - $msg .= "\r\n{$name}: " . $value; + $msg .= "\r\n{$name}: ".$value; } } else { - $msg .= "\r\n{$name}: " . implode(', ', $values); + $msg .= "\r\n{$name}: ".implode(', ', $values); } } - return "{$msg}\r\n\r\n" . $message->getBody(); + return "{$msg}\r\n\r\n".$message->getBody(); } /** @@ -190,7 +190,7 @@ public static function parseRequestUri(string $path, array $headers): string $host = $headers[reset($hostKey)][0]; $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; - return $scheme . '://' . $host . '/' . ltrim($path, '/'); + return $scheme.'://'.$host.'/'.ltrim($path, '/'); } /** @@ -231,7 +231,7 @@ public static function parseResponse(string $message): ResponseInterface // between status-code and reason-phrase is required. But browsers accept // responses without space and reason as well. if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { - throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + throw new \InvalidArgumentException('Invalid response string: '.$data['start-line']); } $parts = explode(' ', $data['start-line'], 3); diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MessageTrait.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MessageTrait.php index 464bdfaa406..a85d3ab2569 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MessageTrait.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MessageTrait.php @@ -16,7 +16,7 @@ trait MessageTrait private $headers = []; /** @var array Map of lowercase header name => original name at registration */ - private $headerNames = []; + private $headerNames = []; /** @var string */ private $protocol = '1.1'; @@ -37,6 +37,7 @@ public function withProtocolVersion($version): MessageInterface $new = clone $this; $new->protocol = $version; + return $new; } @@ -135,6 +136,7 @@ public function withBody(StreamInterface $body): MessageInterface $new = clone $this; $new->stream = $body; + return $new; } @@ -224,7 +226,7 @@ private function assertHeader($header): void )); } - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { + if (!preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { throw new \InvalidArgumentException( sprintf('"%s" is not valid header name.', $header) ); @@ -254,7 +256,7 @@ private function assertValue(string $value): void // Clients must not send a request with line folding and a server sending folded headers is // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting // folding is not likely to break any legitimate use case. - if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { + if (!preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { throw new \InvalidArgumentException( sprintf('"%s" is not valid header value.', $value) ); diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MimeType.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MimeType.php index 0debbd18c35..b131bdbe7af 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MimeType.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MimeType.php @@ -18,7 +18,7 @@ final class MimeType '7zip' => 'application/x-7z-compressed', '123' => 'application/vnd.lotus-1-2-3', 'aab' => 'application/x-authorware-bin', - 'aac' => 'audio/x-acc', + 'aac' => 'audio/aac', 'aam' => 'application/x-authorware-map', 'aas' => 'application/x-authorware-seg', 'abw' => 'application/x-abiword', @@ -29,6 +29,7 @@ final class MimeType 'acu' => 'application/vnd.acucobol', 'acutc' => 'application/vnd.acucorp', 'adp' => 'audio/adpcm', + 'adts' => 'audio/aac', 'aep' => 'application/vnd.audiograph', 'afm' => 'application/x-font-type1', 'afp' => 'application/vnd.ibm.modcap', @@ -41,11 +42,16 @@ final class MimeType 'air' => 'application/vnd.adobe.air-application-installer-package+zip', 'ait' => 'application/vnd.dvb.ait', 'ami' => 'application/vnd.amiga.ami', + 'aml' => 'application/automationml-aml+xml', + 'amlx' => 'application/automationml-amlx+zip', 'amr' => 'audio/amr', 'apk' => 'application/vnd.android.package-archive', 'apng' => 'image/apng', 'appcache' => 'text/cache-manifest', + 'appinstaller' => 'application/appinstaller', 'application' => 'application/x-ms-application', + 'appx' => 'application/appx', + 'appxbundle' => 'application/appxbundle', 'apr' => 'application/vnd.lotus-approach', 'arc' => 'application/x-freearc', 'arj' => 'application/x-arj', @@ -90,6 +96,7 @@ final class MimeType 'bpk' => 'application/octet-stream', 'bpmn' => 'application/octet-stream', 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btf' => 'image/prs.btif', 'btif' => 'image/prs.btif', 'buffer' => 'application/octet-stream', 'bz' => 'application/x-bzip', @@ -141,6 +148,7 @@ final class MimeType 'cjs' => 'application/node', 'cla' => 'application/vnd.claymore', 'class' => 'application/octet-stream', + 'cld' => 'model/vnd.cld', 'clkk' => 'application/vnd.crick.clicker.keyboard', 'clkp' => 'application/vnd.crick.clicker.palette', 'clkt' => 'application/vnd.crick.clicker.template', @@ -175,6 +183,7 @@ final class MimeType 'csv' => 'text/csv', 'cu' => 'application/cu-seeme', 'curl' => 'text/vnd.curl', + 'cwl' => 'application/cwl', 'cww' => 'application/prs.cww', 'cxt' => 'application/x-director', 'cxx' => 'text/x-c', @@ -197,6 +206,7 @@ final class MimeType 'der' => 'application/x-x509-ca-cert', 'dfac' => 'application/vnd.dreamfactory', 'dgc' => 'application/x-dgc-compressed', + 'dib' => 'image/bmp', 'dic' => 'text/x-c', 'dir' => 'application/x-director', 'dis' => 'application/vnd.mobius.dis', @@ -219,6 +229,7 @@ final class MimeType 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dp' => 'application/vnd.osgi.dp', 'dpg' => 'application/vnd.dpgraph', + 'dpx' => 'image/dpx', 'dra' => 'audio/vnd.dra', 'drle' => 'image/dicom-rle', 'dsc' => 'text/prs.lines.tag', @@ -255,7 +266,6 @@ final class MimeType 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'epub' => 'application/epub+zip', - 'es' => 'application/ecmascript', 'es3' => 'application/vnd.eszigno3+xml', 'esa' => 'application/vnd.osgi.subsystem', 'esf' => 'application/vnd.epson.esf', @@ -448,6 +458,7 @@ final class MimeType 'jsonld' => 'application/ld+json', 'jsonml' => 'application/jsonml+json', 'jsx' => 'text/jsx', + 'jt' => 'model/jt', 'jxr' => 'image/jxr', 'jxra' => 'image/jxra', 'jxrs' => 'image/jxrs', @@ -552,7 +563,7 @@ final class MimeType 'mime' => 'message/rfc822', 'mj2' => 'video/mj2', 'mjp2' => 'video/mj2', - 'mjs' => 'application/javascript', + 'mjs' => 'text/javascript', 'mk3d' => 'video/x-matroska', 'mka' => 'audio/x-matroska', 'mkd' => 'text/x-markdown', @@ -602,6 +613,8 @@ final class MimeType 'msg' => 'application/vnd.ms-outlook', 'msh' => 'model/mesh', 'msi' => 'application/x-msdownload', + 'msix' => 'application/msix', + 'msixbundle' => 'application/msixbundle', 'msl' => 'application/vnd.mobius.msl', 'msm' => 'application/octet-stream', 'msp' => 'application/octet-stream', @@ -775,6 +788,8 @@ final class MimeType 'pvb' => 'application/vnd.3gpp.pic-bw-var', 'pwn' => 'application/vnd.3m.post-it-notes', 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyo' => 'model/vnd.pytha.pyox', + 'pyox' => 'model/vnd.pytha.pyox', 'pyv' => 'video/vnd.ms-playready.media.pyv', 'qam' => 'application/vnd.epson.quickanime', 'qbo' => 'application/vnd.intu.qbo', @@ -923,10 +938,12 @@ final class MimeType 'st' => 'application/vnd.sailingtracker.track', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', + 'step' => 'application/STEP', 'stf' => 'application/vnd.wt.stf', 'sti' => 'application/vnd.sun.xml.impress.template', 'stk' => 'application/hyperstudio', 'stl' => 'model/stl', + 'stp' => 'application/STEP', 'stpx' => 'model/step+xml', 'stpxz' => 'model/step-xml+zip', 'stpz' => 'model/step+zip', @@ -1013,10 +1030,12 @@ final class MimeType 'ulx' => 'application/x-glulx', 'umj' => 'application/vnd.umajin', 'unityweb' => 'application/vnd.unity', + 'uo' => 'application/vnd.uoml+xml', 'uoml' => 'application/vnd.uoml+xml', 'uri' => 'text/uri-list', 'uris' => 'text/uri-list', 'urls' => 'text/uri-list', + 'usda' => 'model/vnd.usda', 'usdz' => 'model/vnd.usdz+zip', 'ustar' => 'application/x-ustar', 'utz' => 'application/vnd.uiq.theme', @@ -1096,6 +1115,7 @@ final class MimeType 'webmanifest' => 'application/manifest+json', 'webp' => 'image/webp', 'wg' => 'application/vnd.pmi.widget', + 'wgsl' => 'text/wgsl', 'wgt' => 'application/widget', 'wif' => 'application/watcherinfo+xml', 'wks' => 'application/vnd.ms-works', @@ -1150,9 +1170,10 @@ final class MimeType 'xel' => 'application/xcap-el+xml', 'xenc' => 'application/xenc+xml', 'xer' => 'application/patch-ops-error+xml', - 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdf' => 'application/xfdf', 'xfdl' => 'application/vnd.xfdl', 'xht' => 'application/xhtml+xml', + 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', 'xhtml' => 'application/xhtml+xml', 'xhvml' => 'application/xv+xml', 'xif' => 'image/vnd.xiff', @@ -1183,6 +1204,7 @@ final class MimeType 'xpw' => 'application/vnd.intercon.formnet', 'xpx' => 'application/vnd.intercon.formnet', 'xsd' => 'application/xml', + 'xsf' => 'application/prs.xsf+xml', 'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml', 'xsm' => 'application/vnd.syncml+xml', @@ -1218,7 +1240,7 @@ final class MimeType /** * Determines the mimetype of a file by looking at its extension. * - * @link https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json */ public static function fromFilename(string $filename): ?string { @@ -1228,7 +1250,7 @@ public static function fromFilename(string $filename): ?string /** * Maps a file extensions to a mimetype. * - * @link https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json */ public static function fromExtension(string $extension): ?string { diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MultipartStream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MultipartStream.php index 3e12b74d152..41c48eef8a0 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MultipartStream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/MultipartStream.php @@ -60,7 +60,7 @@ private function getHeaders(array $headers): string $str .= "{$key}: {$value}\r\n"; } - return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + return "--{$this->boundary}\r\n".trim($str)."\r\n\r\n"; } /** @@ -72,7 +72,7 @@ protected function createStream(array $elements = []): StreamInterface foreach ($elements as $element) { if (!is_array($element)) { - throw new \UnexpectedValueException("An array is expected"); + throw new \UnexpectedValueException('An array is expected'); } $this->addElement($stream, $element); } @@ -137,9 +137,7 @@ private function createElement(string $name, StreamInterface $stream, ?string $f // Set a default Content-Type if one was not supplied $type = $this->getHeader($headers, 'content-type'); if (!$type && ($filename === '0' || $filename)) { - if ($type = MimeType::fromFilename($filename)) { - $headers['Content-Type'] = $type; - } + $headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream'; } return [$stream, $headers]; diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/PumpStream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/PumpStream.php index e90389c3b77..b52341d9ea7 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/PumpStream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/PumpStream.php @@ -60,6 +60,7 @@ public function __toString(): string throw $e; } trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; } } @@ -169,6 +170,7 @@ private function pump(int $length): void $data = call_user_func($this->source, $length); if ($data === false || $data === null) { $this->source = null; + return; } $this->buffer->write($data); diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Query.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Query.php index 2faab3a889e..8b94927973c 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Query.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Query.php @@ -93,7 +93,7 @@ public static function build(array $params, $encoding = PHP_QUERY_RFC3986): stri $qs .= $k; $v = is_bool($v) ? (int) $v : $v; if ($v !== null) { - $qs .= '=' . $encoder((string) $v); + $qs .= '='.$encoder((string) $v); } $qs .= '&'; } else { @@ -101,7 +101,7 @@ public static function build(array $params, $encoding = PHP_QUERY_RFC3986): stri $qs .= $k; $vv = is_bool($vv) ? (int) $vv : $vv; if ($vv !== null) { - $qs .= '=' . $encoder((string) $vv); + $qs .= '='.$encoder((string) $vv); } $qs .= '&'; } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Request.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Request.php index b17af66a2c8..db29d95d38c 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Request.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Request.php @@ -69,7 +69,7 @@ public function getRequestTarget(): string $target = '/'; } if ($this->uri->getQuery() != '') { - $target .= '?' . $this->uri->getQuery(); + $target .= '?'.$this->uri->getQuery(); } return $target; @@ -85,6 +85,7 @@ public function withRequestTarget($requestTarget): RequestInterface $new = clone $this; $new->requestTarget = $requestTarget; + return $new; } @@ -98,6 +99,7 @@ public function withMethod($method): RequestInterface $this->assertMethod($method); $new = clone $this; $new->method = strtoupper($method); + return $new; } @@ -131,7 +133,7 @@ private function updateHostFromUri(): void } if (($port = $this->uri->getPort()) !== null) { - $host .= ':' . $port; + $host .= ':'.$port; } if (isset($this->headerNames['host'])) { diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Response.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Response.php index 4c6ee6f0367..8fc11478be7 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Response.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Response.php @@ -138,6 +138,7 @@ public function withStatus($code, $reasonPhrase = ''): ResponseInterface $reasonPhrase = self::PHRASES[$new->statusCode]; } $new->reasonPhrase = (string) $reasonPhrase; + return $new; } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Rfc7230.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Rfc7230.php index 30224018d39..8219dba4dc1 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Rfc7230.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Rfc7230.php @@ -14,7 +14,7 @@ final class Rfc7230 * * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons. * - * @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 + * @see https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 * * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE */ diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/ServerRequest.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/ServerRequest.php index b2aa382dadc..1198ff63d5d 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/ServerRequest.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/ServerRequest.php @@ -144,10 +144,10 @@ private static function normalizeNestedFileSpec(array $files = []): array foreach (array_keys($files['tmp_name']) as $key) { $spec = [ 'tmp_name' => $files['tmp_name'][$key], - 'size' => $files['size'][$key] ?? null, - 'error' => $files['error'][$key] ?? null, - 'name' => $files['name'][$key] ?? null, - 'type' => $files['type'][$key] ?? null, + 'size' => $files['size'][$key] ?? null, + 'error' => $files['error'][$key] ?? null, + 'name' => $files['name'][$key] ?? null, + 'type' => $files['type'][$key] ?? null, ]; $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); } @@ -182,7 +182,7 @@ public static function fromGlobals(): ServerRequestInterface private static function extractHostAndPortFromAuthority(string $authority): array { - $uri = 'http://' . $authority; + $uri = 'http://'.$authority; $parts = parse_url($uri); if (false === $parts) { return [null, null]; diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Stream.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Stream.php index ecd31861e17..c2477fe321f 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Stream.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Stream.php @@ -61,8 +61,8 @@ public function __construct($stream, array $options = []) $this->stream = $stream; $meta = stream_get_meta_data($this->stream); $this->seekable = $meta['seekable']; - $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); - $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->readable = (bool) preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool) preg_match(self::WRITABLE_MODES, $meta['mode']); $this->uri = $this->getMetadata('uri'); } @@ -80,12 +80,14 @@ public function __toString(): string if ($this->isSeekable()) { $this->seek(0); } + return $this->getContents(); } catch (\Throwable $e) { if (\PHP_VERSION_ID >= 70400) { throw $e; } trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; } } @@ -145,6 +147,7 @@ public function getSize(): ?int $stats = fstat($this->stream); if (is_array($stats) && isset($stats['size'])) { $this->size = $stats['size']; + return $this->size; } @@ -207,7 +210,7 @@ public function seek($offset, $whence = SEEK_SET): void } if (fseek($this->stream, $offset, $whence) === -1) { throw new \RuntimeException('Unable to seek to stream position ' - . $offset . ' with whence ' . var_export($whence, true)); + .$offset.' with whence '.var_export($whence, true)); } } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamDecoratorTrait.php index 56d4104d450..dfb3e45493d 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamDecoratorTrait.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -31,6 +31,7 @@ public function __get(string $name) { if ($name === 'stream') { $this->stream = $this->createStream(); + return $this->stream; } @@ -43,12 +44,14 @@ public function __toString(): string if ($this->isSeekable()) { $this->seek(0); } + return $this->getContents(); } catch (\Throwable $e) { if (\PHP_VERSION_ID >= 70400) { throw $e; } trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + return ''; } } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamWrapper.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamWrapper.php index 2a934640356..b3655cb3a98 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamWrapper.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/StreamWrapper.php @@ -41,7 +41,7 @@ public static function getResource(StreamInterface $stream) $mode = 'w'; } else { throw new \InvalidArgumentException('The stream must be readable, ' - . 'writable, or both.'); + .'writable, or both.'); } return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream)); @@ -55,7 +55,7 @@ public static function getResource(StreamInterface $stream) public static function createStreamContext(StreamInterface $stream) { return stream_context_create([ - 'guzzle' => ['stream' => $stream] + 'guzzle' => ['stream' => $stream], ]); } @@ -115,7 +115,7 @@ public function stream_seek(int $offset, int $whence): bool */ public function stream_cast(int $cast_as) { - $stream = clone($this->stream); + $stream = clone $this->stream; $resource = $stream->detach(); return $resource ?? false; @@ -127,27 +127,27 @@ public function stream_cast(int $cast_as) public function stream_stat(): array { static $modeMap = [ - 'r' => 33060, + 'r' => 33060, 'rb' => 33060, 'r+' => 33206, - 'w' => 33188, - 'wb' => 33188 + 'w' => 33188, + 'wb' => 33188, ]; return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => $modeMap[$this->mode], - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => $this->stream->getSize() ?: 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, 'blksize' => 0, - 'blocks' => 0 + 'blocks' => 0, ]; } @@ -157,19 +157,19 @@ public function stream_stat(): array public function url_stat(string $path, int $flags): array { return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => 0, - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, 'blksize' => 0, - 'blocks' => 0 + 'blocks' => 0, ]; } } diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Uri.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Uri.php index 09e878d3d96..fbba7f12303 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Uri.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Uri.php @@ -25,7 +25,7 @@ class Uri implements UriInterface, \JsonSerializable private const HTTP_DEFAULT_HOST = 'localhost'; private const DEFAULT_PORTS = [ - 'http' => 80, + 'http' => 80, 'https' => 443, 'ftp' => 21, 'gopher' => 70, @@ -41,14 +41,14 @@ class Uri implements UriInterface, \JsonSerializable /** * Unreserved characters for use in a regex. * - * @link https://tools.ietf.org/html/rfc3986#section-2.3 + * @see https://tools.ietf.org/html/rfc3986#section-2.3 */ private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; /** * Sub-delims for use in a regex. * - * @link https://tools.ietf.org/html/rfc3986#section-2.2 + * @see https://tools.ietf.org/html/rfc3986#section-2.2 */ private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; @@ -87,6 +87,7 @@ public function __construct(string $uri = '') $this->applyParts($parts); } } + /** * UTF-8 aware \parse_url() replacement. * @@ -121,7 +122,7 @@ static function ($matches) { $url ); - $result = parse_url($prefix . $encodedUrl); + $result = parse_url($prefix.$encodedUrl); if ($result === false) { return false; @@ -161,7 +162,7 @@ public function __toString(): string * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to * that format). * - * @link https://tools.ietf.org/html/rfc3986#section-5.3 + * @see https://tools.ietf.org/html/rfc3986#section-5.3 */ public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string { @@ -169,25 +170,25 @@ public static function composeComponents(?string $scheme, ?string $authority, st // weak type checks to also accept null until we can add scalar type hints if ($scheme != '') { - $uri .= $scheme . ':'; + $uri .= $scheme.':'; } if ($authority != '' || $scheme === 'file') { - $uri .= '//' . $authority; + $uri .= '//'.$authority; } if ($authority != '' && $path != '' && $path[0] != '/') { - $path = '/' . $path; + $path = '/'.$path; } $uri .= $path; if ($query != '') { - $uri .= '?' . $query; + $uri .= '?'.$query; } if ($fragment != '') { - $uri .= '#' . $fragment; + $uri .= '#'.$fragment; } return $uri; @@ -218,7 +219,7 @@ public static function isDefaultPort(UriInterface $uri): bool * @see Uri::isNetworkPathReference * @see Uri::isAbsolutePathReference * @see Uri::isRelativePathReference - * @link https://tools.ietf.org/html/rfc3986#section-4 + * @see https://tools.ietf.org/html/rfc3986#section-4 */ public static function isAbsolute(UriInterface $uri): bool { @@ -230,7 +231,7 @@ public static function isAbsolute(UriInterface $uri): bool * * A relative reference that begins with two slash characters is termed an network-path reference. * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://tools.ietf.org/html/rfc3986#section-4.2 */ public static function isNetworkPathReference(UriInterface $uri): bool { @@ -242,7 +243,7 @@ public static function isNetworkPathReference(UriInterface $uri): bool * * A relative reference that begins with a single slash character is termed an absolute-path reference. * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://tools.ietf.org/html/rfc3986#section-4.2 */ public static function isAbsolutePathReference(UriInterface $uri): bool { @@ -257,7 +258,7 @@ public static function isAbsolutePathReference(UriInterface $uri): bool * * A relative reference that does not begin with a slash character is termed a relative-path reference. * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://tools.ietf.org/html/rfc3986#section-4.2 */ public static function isRelativePathReference(UriInterface $uri): bool { @@ -276,7 +277,7 @@ public static function isRelativePathReference(UriInterface $uri): bool * @param UriInterface $uri The URI to check * @param UriInterface|null $base An optional base URI to compare against * - * @link https://tools.ietf.org/html/rfc3986#section-4.4 + * @see https://tools.ietf.org/html/rfc3986#section-4.4 */ public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool { @@ -352,7 +353,7 @@ public static function withQueryValues(UriInterface $uri, array $keyValueArray): /** * Creates a URI from a hash of `parse_url` components. * - * @link http://php.net/manual/en/function.parse-url.php + * @see http://php.net/manual/en/function.parse-url.php * * @throws MalformedUriException If the components do not form a valid URI. */ @@ -374,11 +375,11 @@ public function getAuthority(): string { $authority = $this->host; if ($this->userInfo !== '') { - $authority = $this->userInfo . '@' . $authority; + $authority = $this->userInfo.'@'.$authority; } if ($this->port !== null) { - $authority .= ':' . $this->port; + $authority .= ':'.$this->port; } return $authority; @@ -435,7 +436,7 @@ public function withUserInfo($user, $password = null): UriInterface { $info = $this->filterUserInfoComponent($user); if ($password !== null) { - $info .= ':' . $this->filterUserInfoComponent($password); + $info .= ':'.$this->filterUserInfoComponent($password); } if ($this->userInfo === $info) { @@ -563,7 +564,7 @@ private function applyParts(array $parts): void ? $this->filterQueryAndFragment($parts['fragment']) : ''; if (isset($parts['pass'])) { - $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + $this->userInfo .= ':'.$this->filterUserInfoComponent($parts['pass']); } $this->removeDefaultPort(); @@ -595,7 +596,7 @@ private function filterUserInfoComponent($component): string } return preg_replace_callback( - '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/', + '/(?:[^%'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.']+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $component ); @@ -627,7 +628,7 @@ private function filterPort($port): ?int } $port = (int) $port; - if (0 > $port || 0xffff < $port) { + if (0 > $port || 0xFFFF < $port) { throw new \InvalidArgumentException( sprintf('Invalid port: %d. Must be between 0 and 65535', $port) ); @@ -664,7 +665,7 @@ private static function generateQueryString(string $key, ?string $value): string $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); if ($value !== null) { - $queryString .= '=' . strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); + $queryString .= '='.strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); } return $queryString; @@ -691,7 +692,7 @@ private function filterPath($path): string } return preg_replace_callback( - '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path ); @@ -711,7 +712,7 @@ private function filterQueryAndFragment($str): string } return preg_replace_callback( - '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str ); diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriNormalizer.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriNormalizer.php index e12971eddae..3d98210b05c 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriNormalizer.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriNormalizer.php @@ -11,7 +11,7 @@ * * @author Tobias Schultze * - * @link https://tools.ietf.org/html/rfc3986#section-6 + * @see https://tools.ietf.org/html/rfc3986#section-6 */ final class UriNormalizer { @@ -119,7 +119,7 @@ final class UriNormalizer * @param UriInterface $uri The URI to normalize * @param int $flags A bitmask of normalizations to apply, see constants * - * @link https://tools.ietf.org/html/rfc3986#section-6.2 + * @see https://tools.ietf.org/html/rfc3986#section-6.2 */ public static function normalize(UriInterface $uri, int $flags = self::PRESERVING_NORMALIZATIONS): UriInterface { @@ -174,7 +174,7 @@ public static function normalize(UriInterface $uri, int $flags = self::PRESERVIN * @param UriInterface $uri2 An URI to compare * @param int $normalizations A bitmask of normalizations to apply, see constants * - * @link https://tools.ietf.org/html/rfc3986#section-6.1 + * @see https://tools.ietf.org/html/rfc3986#section-6.1 */ public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool { diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriResolver.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriResolver.php index 426e5c9adf1..b942d1cece6 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriResolver.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/UriResolver.php @@ -11,14 +11,14 @@ * * @author Tobias Schultze * - * @link https://tools.ietf.org/html/rfc3986#section-5 + * @see https://tools.ietf.org/html/rfc3986#section-5 */ final class UriResolver { /** * Removes dot segments from a path and returns the new path. * - * @link http://tools.ietf.org/html/rfc3986#section-5.2.4 + * @see http://tools.ietf.org/html/rfc3986#section-5.2.4 */ public static function removeDotSegments(string $path): string { @@ -40,7 +40,7 @@ public static function removeDotSegments(string $path): string if ($path[0] === '/' && (!isset($newPath[0]) || $newPath[0] !== '/')) { // Re-add the leading slash if necessary for cases like "/.." - $newPath = '/' . $newPath; + $newPath = '/'.$newPath; } elseif ($newPath !== '' && ($segment === '.' || $segment === '..')) { // Add the trailing slash if necessary // If newPath is not empty, then $segment must be set and is the last segment from the foreach @@ -53,7 +53,7 @@ public static function removeDotSegments(string $path): string /** * Converts the relative URI into a new URI that is resolved against the base URI. * - * @link http://tools.ietf.org/html/rfc3986#section-5.2 + * @see http://tools.ietf.org/html/rfc3986#section-5.2 */ public static function resolve(UriInterface $base, UriInterface $rel): UriInterface { @@ -80,13 +80,13 @@ public static function resolve(UriInterface $base, UriInterface $rel): UriInterf $targetPath = $rel->getPath(); } else { if ($targetAuthority != '' && $base->getPath() === '') { - $targetPath = '/' . $rel->getPath(); + $targetPath = '/'.$rel->getPath(); } else { $lastSlashPos = strrpos($base->getPath(), '/'); if ($lastSlashPos === false) { $targetPath = $rel->getPath(); } else { - $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1).$rel->getPath(); } } } @@ -185,7 +185,7 @@ private static function getRelativePath(UriInterface $base, UriInterface $target } } $targetSegments[] = $targetLastSegment; - $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + $relativePath = str_repeat('../', count($sourceSegments)).implode('/', $targetSegments); // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used diff --git a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Utils.php b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Utils.php index 3a4cf39464e..49b481e53b7 100644 --- a/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Utils.php +++ b/wcfsetup/install/files/lib/system/api/guzzlehttp/psr7/src/Utils.php @@ -90,6 +90,7 @@ public static function copyToString(StreamInterface $stream, int $maxLen = -1): } $buffer .= $buf; } + return $buffer; } @@ -174,7 +175,7 @@ public static function modifyRequest(RequestInterface $request, array $changes): $standardPorts = ['http' => 80, 'https' => 443]; $scheme = $changes['uri']->getScheme(); if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { - $changes['set_headers']['Host'] .= ':' . $port; + $changes['set_headers']['Host'] .= ':'.$port; } } } @@ -291,6 +292,7 @@ public static function streamFor($resource = '', array $options = []): StreamInt fwrite($stream, (string) $resource); fseek($stream, 0); } + return new Stream($stream, $options); } @@ -308,6 +310,7 @@ public static function streamFor($resource = '', array $options = []): StreamInt fseek($stream, 0); $resource = $stream; } + return new Stream($resource, $options); case 'object': /** @var object $resource */ @@ -320,6 +323,7 @@ public static function streamFor($resource = '', array $options = []): StreamInt } $result = $resource->current(); $resource->next(); + return $result; }, $options); } elseif (method_exists($resource, '__toString')) { @@ -334,7 +338,7 @@ public static function streamFor($resource = '', array $options = []): StreamInt return new PumpStream($resource, $options); } - throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); + throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource)); } /**