From 4ae0f8e4e20b55463afa23100386ae02de3e663d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 12 Jul 2022 12:27:48 +0200 Subject: [PATCH] Update composer dependencies --- .../files/lib/system/api/composer.lock | 22 +- .../lib/system/api/composer/installed.json | 24 +- .../lib/system/api/composer/installed.php | 6 +- .../laminas/laminas-diactoros/composer.json | 18 +- .../laminas/laminas-diactoros/composer.lock | 450 +++++++--- .../laminas-diactoros/psalm-baseline.xml | 828 +----------------- .../laminas/laminas-diactoros/renovate.json | 6 + .../src/AbstractSerializer.php | 12 +- .../laminas-diactoros/src/CallbackStream.php | 41 +- .../laminas-diactoros/src/ConfigProvider.php | 12 +- .../Exception/DeserializationException.php | 14 +- .../InvalidForwardedHeaderNameException.php | 6 + .../InvalidProxyAddressException.php | 5 + .../InvalidStreamPointerPositionException.php | 5 +- .../src/Exception/SerializationException.php | 4 +- .../Exception/UnreadableStreamException.php | 8 +- .../UnrecognizedProtocolVersionException.php | 2 +- .../Exception/UnrewindableStreamException.php | 2 +- .../Exception/UnseekableStreamException.php | 8 +- .../Exception/UntellableStreamException.php | 6 +- .../Exception/UnwritableStreamException.php | 8 +- .../UploadedFileAlreadyMovedException.php | 5 +- .../Exception/UploadedFileErrorException.php | 10 +- .../laminas-diactoros/src/HeaderSecurity.php | 32 +- .../laminas-diactoros/src/MessageTrait.php | 68 +- .../laminas-diactoros/src/PhpInputStream.php | 16 +- .../laminas-diactoros/src/RelativeStream.php | 49 +- .../laminas/laminas-diactoros/src/Request.php | 14 +- .../src/Request/ArraySerializer.php | 23 +- .../src/Request/Serializer.php | 37 +- .../laminas-diactoros/src/RequestFactory.php | 2 +- .../laminas-diactoros/src/RequestTrait.php | 47 +- .../laminas-diactoros/src/Response.php | 29 +- .../src/Response/ArraySerializer.php | 18 +- .../src/Response/EmptyResponse.php | 3 +- .../src/Response/HtmlResponse.php | 10 +- .../src/Response/InjectContentTypeTrait.php | 4 +- .../src/Response/JsonResponse.php | 30 +- .../src/Response/RedirectResponse.php | 2 +- .../src/Response/Serializer.php | 30 +- .../src/Response/TextResponse.php | 10 +- .../src/Response/XmlResponse.php | 10 +- .../laminas-diactoros/src/ResponseFactory.php | 2 +- .../laminas-diactoros/src/ServerRequest.php | 67 +- .../src/ServerRequestFactory.php | 71 +- .../FilterUsingXForwardedHeaders.php | 19 +- .../src/ServerRequestFilter/IPRange.php | 18 +- .../laminas/laminas-diactoros/src/Stream.php | 92 +- .../laminas-diactoros/src/StreamFactory.php | 8 +- .../laminas-diactoros/src/UploadedFile.php | 79 +- .../src/UploadedFileFactory.php | 8 +- .../api/laminas/laminas-diactoros/src/Uri.php | 123 ++- .../laminas-diactoros/src/UriFactory.php | 2 +- .../functions/create_uploaded_file.legacy.php | 5 +- .../src/functions/create_uploaded_file.php | 9 +- .../marshal_headers_from_sapi.legacy.php | 3 +- .../functions/marshal_headers_from_sapi.php | 8 +- .../marshal_method_from_sapi.legacy.php | 3 +- .../functions/marshal_method_from_sapi.php | 2 +- ...shal_protocol_version_from_sapi.legacy.php | 3 +- .../marshal_protocol_version_from_sapi.php | 4 +- .../marshal_uri_from_sapi.legacy.php | 5 +- .../src/functions/marshal_uri_from_sapi.php | 33 +- .../src/functions/normalize_server.legacy.php | 3 +- .../src/functions/normalize_server.php | 5 +- .../normalize_uploaded_files.legacy.php | 5 +- .../functions/normalize_uploaded_files.php | 24 +- .../functions/parse_cookie_header.legacy.php | 8 +- .../src/functions/parse_cookie_header.php | 6 +- 69 files changed, 986 insertions(+), 1565 deletions(-) create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/renovate.json diff --git a/wcfsetup/install/files/lib/system/api/composer.lock b/wcfsetup/install/files/lib/system/api/composer.lock index b1e4c6db1e..f36691eaf7 100644 --- a/wcfsetup/install/files/lib/system/api/composer.lock +++ b/wcfsetup/install/files/lib/system/api/composer.lock @@ -479,16 +479,16 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.11.2", + "version": "2.13.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "78846cbce0550ec174508a646f46fd6dee76099b" + "reference": "34ba65010be9aa74e159d168c5ecfa5c01e4d956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/78846cbce0550ec174508a646f46fd6dee76099b", - "reference": "78846cbce0550ec174508a646f46fd6dee76099b", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/34ba65010be9aa74e159d168c5ecfa5c01e4d956", + "reference": "34ba65010be9aa74e159d168c5ecfa5c01e4d956", "shasum": "" }, "require": { @@ -509,13 +509,13 @@ "ext-dom": "*", "ext-gd": "*", "ext-libxml": "*", - "http-interop/http-factory-tests": "^0.8.0", - "laminas/laminas-coding-standard": "~1.0.0", - "php-http/psr7-integration-tests": "^1.1", + "http-interop/http-factory-tests": "^0.9.0", + "laminas/laminas-coding-standard": "~2.3.0", + "php-http/psr7-integration-tests": "^1.1.1", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.1", - "psalm/plugin-phpunit": "^0.14.0", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.24.0" }, "type": "library", "extra": { @@ -574,7 +574,7 @@ "type": "community_bridge" } ], - "time": "2022-06-29T14:15:02+00:00" + "time": "2022-07-07T12:31:03+00:00" }, { "name": "laminas/laminas-httphandlerrunner", diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.json b/wcfsetup/install/files/lib/system/api/composer/installed.json index a03c5de777..c3744da165 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.json +++ b/wcfsetup/install/files/lib/system/api/composer/installed.json @@ -491,17 +491,17 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.11.2", - "version_normalized": "2.11.2.0", + "version": "2.13.0", + "version_normalized": "2.13.0.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "78846cbce0550ec174508a646f46fd6dee76099b" + "reference": "34ba65010be9aa74e159d168c5ecfa5c01e4d956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/78846cbce0550ec174508a646f46fd6dee76099b", - "reference": "78846cbce0550ec174508a646f46fd6dee76099b", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/34ba65010be9aa74e159d168c5ecfa5c01e4d956", + "reference": "34ba65010be9aa74e159d168c5ecfa5c01e4d956", "shasum": "" }, "require": { @@ -522,15 +522,15 @@ "ext-dom": "*", "ext-gd": "*", "ext-libxml": "*", - "http-interop/http-factory-tests": "^0.8.0", - "laminas/laminas-coding-standard": "~1.0.0", - "php-http/psr7-integration-tests": "^1.1", + "http-interop/http-factory-tests": "^0.9.0", + "laminas/laminas-coding-standard": "~2.3.0", + "php-http/psr7-integration-tests": "^1.1.1", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.1", - "psalm/plugin-phpunit": "^0.14.0", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.24.0" }, - "time": "2022-06-29T14:15:02+00:00", + "time": "2022-07-07T12:31:03+00:00", "type": "library", "extra": { "laminas": { diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.php b/wcfsetup/install/files/lib/system/api/composer/installed.php index b02b1598af..358ce081f6 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.php +++ b/wcfsetup/install/files/lib/system/api/composer/installed.php @@ -74,9 +74,9 @@ 'dev_requirement' => false, ), 'laminas/laminas-diactoros' => array( - 'pretty_version' => '2.11.2', - 'version' => '2.11.2.0', - 'reference' => '78846cbce0550ec174508a646f46fd6dee76099b', + 'pretty_version' => '2.13.0', + 'version' => '2.13.0.0', + 'reference' => '34ba65010be9aa74e159d168c5ecfa5c01e4d956', 'type' => 'library', 'install_path' => __DIR__ . '/../laminas/laminas-diactoros', 'aliases' => array(), diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json index 27dffe53cc..154e70a5d6 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json @@ -19,9 +19,15 @@ "forum": "https://discourse.laminas.dev" }, "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, "sort-packages": true, "platform": { "php": "7.3.99" + }, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true } }, "extra": { @@ -40,13 +46,13 @@ "ext-dom": "*", "ext-gd": "*", "ext-libxml": "*", - "http-interop/http-factory-tests": "^0.8.0", - "laminas/laminas-coding-standard": "~1.0.0", - "php-http/psr7-integration-tests": "^1.1", + "http-interop/http-factory-tests": "^0.9.0", + "laminas/laminas-coding-standard": "~2.3.0", + "php-http/psr7-integration-tests": "^1.1.1", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.1", - "psalm/plugin-phpunit": "^0.14.0", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.24.0" }, "provide": { "psr/http-factory-implementation": "1.0", diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.lock b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.lock index 738c3e556a..47cde60e00 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.lock +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/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": "764b8219d976768c2309b08663989ae9", + "content-hash": "ab56f78e3052c428dda4d5d8e0cdb17b", "packages": [ { "name": "psr/http-factory", @@ -573,6 +573,81 @@ ], "time": "2022-02-25T21:32:43+00:00" }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.2", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2022-02-04T12:51:07+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -783,16 +858,16 @@ }, { "name": "http-interop/http-factory-tests", - "version": "0.8.0", + "version": "0.9.0", "source": { "type": "git", "url": "https://github.com/http-interop/http-factory-tests.git", - "reference": "7384d93cd4841647b16b3c9bfd56c0367a40fce1" + "reference": "642056c5360e8a74779cbf133afbc8aa2c174e15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-factory-tests/zipball/7384d93cd4841647b16b3c9bfd56c0367a40fce1", - "reference": "7384d93cd4841647b16b3c9bfd56c0367a40fce1", + "url": "https://api.github.com/repos/http-interop/http-factory-tests/zipball/642056c5360e8a74779cbf133afbc8aa2c174e15", + "reference": "642056c5360e8a74779cbf133afbc8aa2c174e15", "shasum": "" }, "require": { @@ -826,37 +901,42 @@ ], "support": { "issues": "https://github.com/http-interop/http-factory-tests/issues", - "source": "https://github.com/http-interop/http-factory-tests/tree/0.8.0" + "source": "https://github.com/http-interop/http-factory-tests/tree/0.9.0" }, - "time": "2020-11-02T14:43:36+00:00" + "time": "2021-03-21T14:26:06+00:00" }, { "name": "laminas/laminas-coding-standard", - "version": "1.0.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-coding-standard.git", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539" + "reference": "bcf6e07fe4690240be7beb6d884d0b0fafa6a251" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/08880ce2fbfe62d471cd3cb766a91da630b32539", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539", + "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/bcf6e07fe4690240be7beb6d884d0b0fafa6a251", + "reference": "bcf6e07fe4690240be7beb6d884d0b0fafa6a251", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "squizlabs/php_codesniffer": "^2.7" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "php": "^7.3 || ^8.0", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.6", + "webimpress/coding-standard": "^1.2" }, - "replace": { - "zendframework/zend-coding-standard": "self.version" + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "LaminasCodingStandard\\": "src/LaminasCodingStandard/" + } }, - "type": "library", "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Laminas coding standard", + "description": "Laminas Coding Standard", "homepage": "https://laminas.dev", "keywords": [ "Coding Standard", @@ -870,69 +950,13 @@ "rss": "https://github.com/laminas/laminas-coding-standard/releases.atom", "source": "https://github.com/laminas/laminas-coding-standard" }, - "time": "2019-12-31T16:28:26+00:00" - }, - { - "name": "laminas/laminas-zendframework-bridge", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "88bf037259869891afce6504cacc4f8a07b24d0f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/88bf037259869891afce6504cacc4f8a07b24d0f", - "reference": "88bf037259869891afce6504cacc4f8a07b24d0f", - "shasum": "" - }, - "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.6" - }, - "type": "library", - "extra": { - "laminas": { - "module": "Laminas\\ZendFrameworkBridge" - } - }, - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Laminas\\ZendFrameworkBridge\\": "src//" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Alias legacy ZF class names to Laminas Project equivalents.", - "keywords": [ - "ZendFramework", - "autoloading", - "laminas", - "zf" - ], - "support": { - "forum": "https://discourse.laminas.dev/", - "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", - "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", - "source": "https://github.com/laminas/laminas-zendframework-bridge" - }, "funding": [ { "url": "https://funding.communitybridge.org/projects/laminas-project", "type": "community_bridge" } ], - "time": "2021-12-21T14:34:37+00:00" + "time": "2021-05-29T15:53:59+00:00" }, { "name": "myclabs/deep-copy", @@ -1602,6 +1626,51 @@ }, "time": "2020-07-09T08:33:42+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.6.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "135607f9ccc297d6923d49c2bcf309f509413215" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/135607f9ccc297d6923d49c2bcf309f509413215", + "reference": "135607f9ccc297d6923d49c2bcf309f509413215", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.6.4" + }, + "time": "2022-06-26T13:09:08+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.15", @@ -2024,16 +2093,16 @@ }, { "name": "psalm/plugin-phpunit", - "version": "0.14.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/psalm/psalm-plugin-phpunit.git", - "reference": "f5147be764449ff5a11bded483b622e1e868f8ab" + "reference": "45951541beef07e93e3ad197daf01da88e85c31d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/psalm-plugin-phpunit/zipball/f5147be764449ff5a11bded483b622e1e868f8ab", - "reference": "f5147be764449ff5a11bded483b622e1e868f8ab", + "url": "https://api.github.com/repos/psalm/psalm-plugin-phpunit/zipball/45951541beef07e93e3ad197daf01da88e85c31d", + "reference": "45951541beef07e93e3ad197daf01da88e85c31d", "shasum": "" }, "require": { @@ -2041,7 +2110,7 @@ "composer/semver": "^1.4 || ^2.0 || ^3.0", "ext-simplexml": "*", "php": "^7.1 || ^8.0", - "vimeo/psalm": "dev-master || dev-4.x || ^4.0" + "vimeo/psalm": "dev-master || dev-4.x || ^4.5" }, "conflict": { "phpunit/phpunit": "<7.5" @@ -2078,9 +2147,9 @@ "description": "Psalm plugin for PHPUnit", "support": { "issues": "https://github.com/psalm/psalm-plugin-phpunit/issues", - "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.14.0" + "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.17.0" }, - "time": "2020-12-08T22:25:25+00:00" + "time": "2022-06-14T17:05:57+00:00" }, { "name": "psr/container", @@ -3144,66 +3213,100 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "7.2.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.5.1", + "squizlabs/php_codesniffer": "^3.6.2" + }, + "require-dev": { + "phing/phing": "2.17.3", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan-deprecation-rules": "1.0.0", + "phpstan/phpstan-phpunit": "1.0.0|1.1.1", + "phpstan/phpstan-strict-rules": "1.2.3", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2022-05-25T10:58:12+00:00" + }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -3215,7 +3318,7 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" @@ -3225,20 +3328,20 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2018-11-07T22:31:41+00:00" + "time": "2022-06-18T07:21:10+00:00" }, { "name": "symfony/console", - "version": "v5.4.9", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb" + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/829d5d1bf60b2efeb0887b7436873becc71a45eb", - "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb", + "url": "https://api.github.com/repos/symfony/console/zipball/4d671ab4ddac94ee439ea73649c69d9d200b5000", + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000", "shasum": "" }, "require": { @@ -3308,7 +3411,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.9" + "source": "https://github.com/symfony/console/tree/v5.4.10" }, "funding": [ { @@ -3324,11 +3427,11 @@ "type": "tidelift" } ], - "time": "2022-05-18T06:17:34+00:00" + "time": "2022-06-26T13:00:04+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -3375,7 +3478,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -3887,16 +3990,16 @@ }, { "name": "symfony/service-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { @@ -3950,7 +4053,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -3966,20 +4069,20 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:07:29+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/string", - "version": "v5.4.9", + "version": "v5.4.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" + "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", - "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "url": "https://api.github.com/repos/symfony/string/zipball/4432bc7df82a554b3e413a8570ce2fea90e94097", + "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097", "shasum": "" }, "require": { @@ -4036,7 +4139,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.9" + "source": "https://github.com/symfony/string/tree/v5.4.10" }, "funding": [ { @@ -4052,7 +4155,7 @@ "type": "tidelift" } ], - "time": "2022-04-19T10:40:37+00:00" + "time": "2022-06-26T15:57:47+00:00" }, { "name": "theseer/tokenizer", @@ -4106,16 +4209,16 @@ }, { "name": "vimeo/psalm", - "version": "4.23.0", + "version": "4.24.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88" + "reference": "06dd975cb55d36af80f242561738f16c5f58264f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1fe6ff483bf325c803df9f510d09a03fd796f88", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/06dd975cb55d36af80f242561738f16c5f58264f", + "reference": "06dd975cb55d36af80f242561738f16c5f58264f", "shasum": "" }, "require": { @@ -4207,9 +4310,64 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.23.0" + "source": "https://github.com/vimeo/psalm/tree/4.24.0" + }, + "time": "2022-06-26T11:47:54+00:00" + }, + { + "name": "webimpress/coding-standard", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/webimpress/coding-standard.git", + "reference": "cd0c4b0b97440c337c1f7da17b524674ca2f9ca9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webimpress/coding-standard/zipball/cd0c4b0b97440c337c1f7da17b524674ca2f9ca9", + "reference": "cd0c4b0b97440c337c1f7da17b524674ca2f9ca9", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "squizlabs/php_codesniffer": "^3.6.2" }, - "time": "2022-04-28T17:35:49+00:00" + "require-dev": { + "phpunit/phpunit": "^9.5.13" + }, + "type": "phpcodesniffer-standard", + "extra": { + "dev-master": "1.2.x-dev", + "dev-develop": "1.3.x-dev" + }, + "autoload": { + "psr-4": { + "WebimpressCodingStandard\\": "src/WebimpressCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "Webimpress Coding Standard", + "keywords": [ + "Coding Standard", + "PSR-2", + "phpcs", + "psr-12", + "webimpress" + ], + "support": { + "issues": "https://github.com/webimpress/coding-standard/issues", + "source": "https://github.com/webimpress/coding-standard/tree/1.2.4" + }, + "funding": [ + { + "url": "https://github.com/michalbundyra", + "type": "github" + } + ], + "time": "2022-02-15T19:52:12+00:00" }, { "name": "webmozart/assert", @@ -4338,5 +4496,5 @@ "platform-overrides": { "php": "7.3.99" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/psalm-baseline.xml b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/psalm-baseline.xml index 1456fb1248..17bb976e7b 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/psalm-baseline.xml +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/psalm-baseline.xml @@ -1,5 +1,5 @@ - + null|callable @@ -14,25 +14,10 @@ $previous->getCode() - - - $code - - - $code - - - - - $code - - - $code - - - + ! is_string($name) + ! is_string($stream) && ! is_resource($stream) is_string($version) @@ -44,9 +29,6 @@ $headerNames - - $stream - $header $header @@ -243,9 +225,8 @@ - + $headers['cookie'] - $host $headers @@ -289,19 +270,6 @@ - - - ?int - - - $stats['size'] - - - $resource - - - $resource - $resource $this->resource @@ -311,9 +279,6 @@ $stream - - is_resource($resource) - @@ -440,12 +405,11 @@ $headers[$header] $host - + $host $iisUrlRewritten $origPathInfo $unencodedUrl - $value array @@ -503,52 +467,26 @@ - - $cookieHeader - func_get_args() + + + $cookies + + + array<non-empty-string, string> + + function () { - - $callback - $expected - - - $callback - $ret $ret - - array - - - - - $assertion - $expected - $value - $value - $value - - - assertValues - getFilterValues - testAssertValidRaisesExceptionForInvalidValue - testFiltersValuesPerRfc7230 - testValidatesValuesPerRfc7230 - validateValues - - - $value - $value - @@ -556,406 +494,45 @@ - - $value - $value + $value $version - - [ $value ] - [ $value ] - - - - - $message - $test - - - assertStreamContents - getFileContents - testCanReadStreamIteratively - testCastingToStringReturnsFullContentsRegardlesOfPriorReads - testGetContentsReturnCacheWhenReachedEof - testGetContentsReturnsRemainingContentsOfStream - testMultipleCastsToStringReturnSameContentsEvenIfReadsOccur - testStreamIsNeverWritable - - - $contents - $message - - - $content - $contents - assertSame - - testCanReadContentFromNotSeekableResource - testClose - testDetach - testGetContents - testGetContentsRaisesExceptionWhenPointerIsBehindOffset - testGetMetadata - testGetSize - testIsReadable - testIsSeekable - testIsWritable - testRead - testReadRaisesExceptionWhenPointerIsBehindOffset - testRewind - testSeek - testTell - testToString - testWrite - testWriteRaisesExceptionWhenPointerIsBehindOffset - - - - - testDeserializeFromArray - testMissingBodyParamInSerializedRequestThrowsException - testSerializeToArray - function () use ($payload) { - - $exceptionMessage - $expectations - $expectations - $line - $line - $line - $message - $requestTarget - $requestTarget - $text - - - $exceptionMessage - $message - $text - $payload[$i++] - - $expect - $expect + $i - $method - $method - - array - array - array - array - array - - + $i - $line - $line - $line - - 'UNLOCK' => ['UNLOCK'] - - - ['TOTALLY INVALID'] - - - $body - $contains - $expected - $headers - $hostKey - $method - $method - $method - $request - $requestTarget - $uri - $value - - - customRequestMethods - headersWithInjectionVectors - hostHeaderKeys - invalidHeaderTypes - invalidMethod - invalidRequestBody - invalidRequestMethod - invalidRequestUri - requestsWithUri - testAllowsCustomRequestMethodsThatFollowSpec - testCanProvideARequestTarget - testConstructorCanAcceptAllMessageParts - testConstructorRaisesExceptionForHeadersWithCRLFVectors - testConstructorRaisesExceptionForInvalidBody - testConstructorRaisesExceptionForInvalidHeaders - testConstructorRaisesExceptionForInvalidMethod - testConstructorRaisesExceptionForInvalidStream - testConstructorRaisesExceptionForInvalidUri - testDefaultStreamIsWritable - testGetHeadersContainsHostHeaderIfUriWithHostIsDeleted - testGetHeadersContainsHostHeaderIfUriWithHostIsPresent - testGetHeadersContainsNoHostHeaderIfNoUriPresent - testGetHeadersContainsNoHostHeaderIfUriDoesNotContainHost - testGetHostHeaderLineReturnsEmptyStringIfNoUriPresent - testGetHostHeaderLineReturnsEmptyStringIfUriDoesNotContainHost - testGetHostHeaderLineReturnsUriHostWhenPresent - testGetHostHeaderReturnsEmptyArrayIfNoUriPresent - testGetHostHeaderReturnsEmptyArrayIfUriDoesNotContainHost - testGetHostHeaderReturnsUriHostWhenHostHeaderDeleted - testGetHostHeaderReturnsUriHostWhenPresent - testHostHeaderNotSetFromUriOnCreationIfHostHeaderSpecified - testHostHeaderSetFromUriOnCreationIfNoHostHeaderSpecified - testHostHeaderUpdatesToUriHostAndPortWhenPreserveHostDisabledAndNonStandardPort - testMethodIsGetByDefault - testMethodMutatorReturnsCloneWithChangedMethod - testNotPassingPreserveHostFlagWhenUpdatingUriWithoutHostDoesNotUpdateHostHeader - testPassingPreserveHostFlagWhenUpdatingUriDoesNotUpdateHostHeader - testRequestTargetCannotContainWhitespace - testRequestTargetDoesNotCacheBetweenInstances - testRequestTargetIsSlashWhenNoUriPresent - testRequestTargetIsSlashWhenUriHasNoPathOrQuery - testReturnsRequestTargetWhenUriIsPresent - testReturnsUnpopulatedUriByDefault - testSettingNewUriResetsRequestTarget - testWithInvalidMethod - testWithUriAndNoPreserveHostWillOverwriteHostHeaderRegardlessOfOriginalCase - testWithUriReturnsNewInstanceWithNewUri - validRequestTargets - - - $body - $contains - $headers - $hostKey - $hostKey - $method - $method - $method - $requestTarget - $uri - - - getRequestTarget - - - - - createResponse - createSerializedResponse - testDeserializeFromArray - testMissingBodyParamInSerializedRequestThrowsException - testSerializeToArray - - - $response - $response - $serializedRequest - $serializedResponse - - - $serializedRequest['body'] - - - $response - $response - $serializedRequest - $serializedResponse - - - - - testConstructor - testHeaderConstructor - - - - - $body - - - invalidHtmlContent - testAllowsStreamsForResponseBody - testConstructorAcceptsHtmlString - testConstructorAllowsPassingHeaders - testConstructorAllowsPassingStatus - testConstructorRewindsBodyStream - testRaisesExceptionforNonStringNonStreamBodyContent - - - $body - - - - - $value - $value - - - scalarValuesForJSON - testCanProvideAlternateContentTypeViaHeadersPassedToConstructor - testCanProvideStatusCodeToConstructor - testConstructorAcceptsDataAndCreatesJsonEncodedMessageBody - testConstructorRewindsBodyStream - testEncodingOptionsGetter - testJsonErrorHandlingOfBadEmbeddedData - testJsonErrorHandlingOfResources - testModifyingThePayloadDoesntMutateResponseInstance - testPayloadGetter - testScalarValuePassedToConstructorJsonEncodesDirectly - testUsesSaneDefaultJsonEncodingFlags - testWithEncodingOptions - testWithPayload - valuesToJsonEncode - - - - - $uri - - - invalidUris - testConstructorAcceptsStringUriAndProduces302ResponseWithLocationHeader - testConstructorAcceptsUriInstanceAndProduces302ResponseWithLocationHeader - testConstructorAllowsSpecifyingAlternateStatusCode - testConstructorAllowsSpecifyingHeaders - testConstructorRaisesExceptionOnInvalidUri - - - $uri - - - - - $exceptionMessage - $message - $text - - - headersWithContinuationLines - messagesWithInvalidHeaders - testCanDeserializeBasicResponse - testCanDeserializeResponseWithHeaderContinuations - testCanDeserializeResponseWithMultipleHeadersOfSameName - testCanDeserializeResponseWithoutBody - testCanDeserializeResponseWithoutHeadersButContainingBody - testCanDeserializeResponseWithoutHeadersOrBody - testDeserializationRaisesExceptionForInvalidStatusLine - testDeserializationRaisesExceptionForMalformedHeaders - testDeserializeCorrectlyCastsStatusCodeToInteger - testFromStreamThrowsExceptionWhenStreamIsNotReadable - testFromStreamThrowsExceptionWhenStreamIsNotSeekable - testOmitsReasonPhraseFromStatusLineIfEmpty - testSerializesBasicResponse - testSerializesMultipleHeadersCorrectly - testSerializesResponseWithoutBodyCorrectly - - - $exceptionMessage - $message - $text - - - - - $body - - - invalidContent - testAllowsStreamsForResponseBody - testConstructorAcceptsBodyAsString - testConstructorAllowsPassingHeaders - testConstructorAllowsPassingStatus - testConstructorRewindsBodyStream - testRaisesExceptionforNonStringNonStreamBodyContent - - - $body - - - - - $body - - - invalidContent - testAllowsStreamsForResponseBody - testConstructorAcceptsBodyAsString - testConstructorAllowsPassingHeaders - testConstructorAllowsPassingStatus - testConstructorRewindsBodyStream - testRaisesExceptionforNonStringNonStreamBodyContent - - $body + $headers - - [ 'TOTALLY INVALID' ] - - - $body - $code - $code - $code - $contains - $headers - $invalidReasonPhrase - $reasonPhrase - $value - - - headersWithInjectionVectors - ianaCodesReasonPhrasesProvider - invalidHeaderTypes - invalidReasonPhrases - invalidResponseBody - invalidStatusCodes - testCanSetCustomReasonPhrase - testCannotSetInvalidStatusCode - testConstructorCanAcceptAllMessageParts - testConstructorRaisesExceptionForHeadersWithCRLFVectors - testConstructorRaisesExceptionForInvalidBody - testConstructorRaisesExceptionForInvalidHeaders - testConstructorRaisesExceptionForInvalidStream - testCreateWithValidStatusCodes - testReasonPhraseCanBeEmpty - testReasonPhraseDefaultsAgainstIana - testReasonPhraseDefaultsToStandards - testStatusCodeIs200ByDefault - testStatusCodeMutatorReturnsCloneWithChanges - testWithStatusRaisesAnExceptionForNonStringReasonPhrases - validStatusCodes - - - $body - $code - $code - $code - $contains - $headers - $invalidReasonPhrase - + + $ianaCodesReasonPhrases + $responseCode + + list<array{numeric-string, non-empty-string}> + assertIsInt @@ -967,105 +544,11 @@ $normalizedFiles['fooFiles'] - - $expected - $protocol - - - cookieHeaderValues - marshalProtocolVersionProvider - testCanCreateServerRequestViaFromGlobalsMethod - testCookieHeaderVariations - testCreateFromGlobalsShouldNotPreserveKeysWhenCreatedWithAnEmptyValue - testCreateFromGlobalsShouldPreserveKeysWhenCreatedWithAZeroValue - testFromGlobalsUsesCookieHeaderInsteadOfCookieSuperGlobal - testFromGlobalsUsesCookieSuperGlobalWhenCookieHeaderIsNotSet - testMarshalHostAndPortReturnsEmptyValuesIfNoHostHeaderAndNoServerName - testMarshalHostAndPortReturnsServerAddrForHostIfPresentAndHostIsIpv6Address - testMarshalHostAndPortReturnsServerNameForHostIfServerAddrPresentButHostIsNotIpv6Address - testMarshalHostAndPortReturnsServerNameForHostWhenPresent - testMarshalHostAndPortReturnsServerPortForPortWhenPresentWithServerName - testMarshalHostAndPortUsesHostHeaderWhenPresent - testMarshalHostAndPortWillDetectPortInHostHeaderWhenPresent - testMarshalHostAndPortWillDetectPortInIpv6StyleHost - testMarshalInvalidHeadersStrippedFromServerArray - testMarshalProtocolReturnsDefaultValueIfHeaderIsNotPresent - testMarshalProtocolVersionReturnsHttpVersions - testMarshalProtocolVersionRisesExceptionIfVersionIsNotRecognized - testMarshalRequestUriFallsBackToRoot - testMarshalRequestUriPrefersRequestUriServerParamWhenXOriginalUrlButNoXRewriteUrlPresent - testMarshalRequestUriStripsSchemeHostAndPortInformationWhenPresent - testMarshalRequestUriUsesIISUnencodedUrlValueIfPresentAndUrlWasRewritten - testMarshalRequestUriUsesOrigPathInfoIfPresent - testMarshalUriDetectsHttpsSchemeFromServerValue - testMarshalUriDetectsHttpsSchemeFromXForwardedProtoValue - testMarshalUriInjectsFragmentFromServer - testMarshalUriInjectsQueryStringFromServer - testMarshalUriStripsQueryStringFromRequestUri - testMarshalUriUsesHttpSchemeIfHttpsServerValueEqualsOff - testMarshalsExpectedHeadersFromServerArray - testMarshalsVariablesPrefixedByApacheFromServerArray - testNormalizeFilesReturnsOnlyActualFilesWhenOriginalFilesContainsNestedAssociativeArrays - testNormalizeServerReturnsArrayUnalteredIfApacheHeadersDoNotContainAuthorization - testNormalizeServerUsesLowerCaseAuthorizationHeaderFromApacheWhenPresent - testNormalizeServerUsesMixedCaseAuthorizationHeaderFromApacheWhenPresent - testReturnsServerValueUnchangedIfHttpAuthorizationHeaderIsPresent - testServerRequestFactoryHasAWritableEmptyBody - - - $data - - - $data - $param - - - array - iterable - $parsedBody - - $methodReturned - $parameterMethod - $request - - - provideMethods - testAllowsRemovingAttributeWithNullValue - testAllowsRemovingNonExistentAttribute - testAttributeMutatorReturnsCloneWithChanges - testAttributesAreEmptyByDefault - testCookieParamsAreAnEmptyArrayAtInitialization - testCookiesAreEmptyByDefault - testCookiesMutatorReturnsCloneWithChanges - testNestedUploadedFiles - testParsedBodyIsEmptyByDefault - testParsedBodyIsNullAtInitialization - testParsedBodyMutatorReturnsCloneWithChanges - testQueryParamsAreAnEmptyArrayAtInitialization - testQueryParamsAreEmptyByDefault - testQueryParamsMutatorReturnsCloneWithChanges - testRemovingAttributeReturnsCloneWithoutAttribute - testServerParamsAreEmptyByDefault - testSingleAttributesWhenEmptyByDefault - testTryToAddInvalidUploadedFiles - testUploadedFilesAreEmptyByDefault - testUsesProvidedConstructorArguments - - - $parameterMethod - - - $new - - - getAttribute - withoutAttribute - @@ -1074,285 +557,28 @@ [' THIS WILL NOT WORK '] - - $fileShouldExist - $fileShouldExist - $flag - $flag - $mode - $mode - $resource - - - $tmpnam - - - findNonExistentTempName - getResourceFor67 - invalidResources - provideDataForIsReadable - provideDataForIsWritable - testAttachWithInvalidStringResourceRaisesException - testAttachWithNonStringNonResourceRaisesException - testAttachWithResourceAttachesResource - testAttachWithStringRepresentingResourceCreatesAndAttachesResource - testCanInstantiateWithGDResource - testCanInstantiateWithStreamIdentifier - testCanInstantiteWithStreamResource - testCanReadContentFromNotSeekableResource - testCloseClosesResource - testCloseDoesNothingAfterDetach - testCloseUnsetsResource - testDetachReturnsResource - testEofReportsFalseWhenNotAtEndOfStream - testEofReportsTrueWhenAtEndOfStream - testEofReportsTrueWhenStreamIsDetached - testGetContentsRisesExceptionIfStreamIsNotReadable - testGetContentsShouldGetFullStreamContents - testGetContentsShouldReturnStreamContentsFromCurrentPointer - testGetMetadataReturnsAllMetadataWhenNoKeyPresent - testGetMetadataReturnsDataForSpecifiedKey - testGetMetadataReturnsNullIfNoDataExistsForKey - testGetSizeReturnsStreamSize - testIsReadableReturnsCorrectFlagForMode - testIsReadableReturnsFalseIfStreamIsNotReadable - testIsReadableReturnsFalseWhenStreamIsDetached - testIsSeekableReturnsFalseForDetachedStreams - testIsSeekableReturnsTrueForReadableStreams - testIsWritableReturnsCorrectFlagForMode - testIsWritableReturnsFalseIfStreamIsNotWritable - testIsWritableReturnsFalseWhenStreamIsDetached - testIsWritableReturnsTrueForWritableMemoryStream - testPassingInvalidStreamResourceToConstructorRaisesException - testRaisesExceptionOnAttachForNonStreamResources - testRaisesExceptionOnConstructionForNonStreamResources - testReadRaisesExceptionWhenStreamIsDetached - testReadReturnsEmptyStringWhenAtEndOfFile - testRewindResetsToStartOfStream - testSeekAdvancesToGivenOffsetOfStream - testSeekRaisesExceptionWhenStreamIsDetached - testSizeReportsNullForPhpInputStreams - testSizeReportsNullWhenNoResourcePresent - testStringSerializationReturnsEmptyStringWhenStreamIsNotReadable - testTellRaisesExceptionIfResourceIsDetached - testTellReportsCurrentPositionInResource - testToStringRetrievesFullContentsOfStream - testWriteRaisesExceptionWhenStreamIsDetached - testWriteRaisesExceptionWhenStreamIsNotWritable - - - $mode - $mode - $resource - $resource - $resource - $this->tmpnam - $this->tmpnam - $this->tmpnam - $this->tmpnam - - - $resource - $resource + $test - - - push - reset - - - + $path - $status - $status - $status - $status - $streamOrFile - - - $tmpFile - - - errorConstantsAndMessages - invalidErrorStatuses - invalidMovePaths - invalidStreams - nonOkErrorStatus - testCannotRetrieveStreamAfterMove - testConstructorDoesNotRaiseExceptionForInvalidStreamWhenErrorStatusPresent - testGetStreamRaisesExceptionWhenErrorStatusPresent - testGetStreamRaisesExceptionWithAppropriateMessageWhenUploadErrorDetected - testGetStreamReturnsOriginalStreamObject - testGetStreamReturnsStreamForFile - testGetStreamReturnsWrappedPhpStream - testMoveCannotBeCalledMoreThanOnce - testMoveRaisesExceptionForInvalidPath - testMoveToCreatesStreamIfOnlyAFilenameWasProvided - testMoveToRaisesExceptionWhenErrorStatusPresent - testMoveToRaisesExceptionWithAppropriateMessageWhenUploadErrorDetected - testMovesFileToDesignatedPath - testRaisesExceptionOnInvalidErrorStatus - testRaisesExceptionOnInvalidStreamOrFile - testValidClientFilename - testValidClientMediaType - testValidNullClientFilename - testValidSize - - - $path - $status - $status - $status - $status $streamOrFile - - $this->tmpfile - - - '3001' + 1 - - $credential - $expected - $expected - $expected - $expected - $method - $method - $path - $port - $port - $port - $query - $query - $query - $result - $result - $scheme - $scheme - $scheme - $url - $url - $url - $user - $value - $value - - - authorityInfo - invalidPaths - invalidPorts - invalidQueryStrings - invalidSchemes - invalidStringComponentValues - mutations - queryStringsForEncoding - standardSchemePortCombinations - testAuthorityIsPrefixedByDoubleSlashIfPresent - testAuthorityOmitsPortForStandardSchemePortCombinations - testCanEmitOriginFormUrl - testCanSerializeToString - testConstructWithUnsupportedSchemeRaisesAnException - testConstructorRaisesExceptionForSeriouslyMalformedURI - testConstructorSetsAllProperties - testESchemeStripsOffDelimiter - testEmptyPathOnOriginFormRemainsAnEmptyPath - testEncodeFragmentPrefixIfPresent - testFragmentIsNotDoubleEncoded - testFragmentIsProperlyEncoded - testHostIsLowercase - testHostIsLowercaseWhenIsSetViwWithHost - testMutatingSchemeStripsOffDelimiter - testMutatingWithUnsupportedSchemeRaisesAnException - testMutationResetsUriStringPropertyInClone - testPassingInvalidValueToWithMethodRaisesException - testPathDoesNotBecomeDoubleEncoded - testPathIsNotPrefixedWithSlashIfSetWithoutOne - testPathIsProperlyEncoded - testPathNotSlashPrefixedIsEmittedWithSlashDelimiterWhenUriIsCastToString - testProperlyTrimsLeadingSlashesToPreventXSS - testQueryIsNotDoubleEncoded - testQueryIsProperlyEncoded - testReservedCharsInPathUnencoded - testRetrievingAuthorityReturnsExpectedValues - testSettingEmptyPathOnAbsoluteUriReturnsAnEmptyPath - testStringRepresentationOfAbsoluteUriWithNoPathSetsAnEmptyPath - testStringRepresentationOfOriginFormWithNoPathRetainsEmptyPath - testStripsQueryPrefixIfPresent - testUriDistinguishZeroFromEmptyString - testUriDoesNotAppendColonToHostIfPortIsEmpty - testUtf8Path - testUtf8Query - testUtf8Uri - testWithFragmentReturnsNewInstanceWithProvidedFragment - testWithFragmentReturnsSameInstanceWithProvidedFragmentSameAsBefore - testWithHostReturnsNewInstanceWithProvidedHost - testWithHostReturnsSameInstanceWithProvidedHostIsSameAsBefore - testWithPathRaisesExceptionForInvalidPaths - testWithPathReturnsNewInstanceWithProvidedPath - testWithPathReturnsSameInstanceWithProvidedPathSameAsBefore - testWithPortRaisesExceptionForInvalidPorts - testWithPortReturnsNewInstanceWithProvidedPort - testWithPortReturnsSameInstanceWithProvidedPortIsSameAsBefore - testWithQueryRaisesExceptionForInvalidQueryStrings - testWithQueryReturnsNewInstanceWithProvidedQuery - testWithSchemeReturnsNewInstanceWithNewScheme - testWithSchemeReturnsSameInstanceWithSameScheme - testWithUserInfoEncodesUsernameAndPassword - testWithUserInfoReturnsNewInstanceWithProvidedUser - testWithUserInfoReturnsNewInstanceWithProvidedUserAndPassword - testWithUserInfoReturnsSameInstanceIfUserAndPasswordAreSameAsBefore - testWithUserInfoThrowExceptionIfPasswordIsNotString - userInfoProvider - utf8PathsDataProvider - utf8QueryStringsDataProvider - validPorts - - - $credential - $expected - $path - $port - $port - $port - $query - $query - $scheme - $scheme + $test - $url - $url - $url - $user $test - - $port - $scheme - - - - - array - array - - - testCreatesUploadedFileFromFlatFileSpecification - testTraversesDenormalizedNestedTreeOfIndicesToExtractUploadedFiles - testTraversesNestedFileSpecificationContainingNumericIndicesToExtractUploadedFiles - testTraversesNestedFileSpecificationToExtractUploadedFile - $normalised['my-form']['details']['avatars'] $normalised['slide-shows'][0]['slides'] diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/renovate.json b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/renovate.json new file mode 100644 index 0000000000..060b1d1a28 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>laminas/.github:renovate-config" + ] +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php index 1ede2889ce..3b290f0594 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php @@ -31,10 +31,10 @@ abstract class AbstractSerializer * Retrieves a line from the stream; a line is defined as a sequence of * characters ending in a CRLF sequence. * - * @throws Exception\DeserializationException if the sequence contains a CR + * @throws Exception\DeserializationException If the sequence contains a CR * or LF in isolation, or ends in a CR. */ - protected static function getLine(StreamInterface $stream) : string + protected static function getLine(StreamInterface $stream): string { $line = ''; $crFound = false; @@ -84,7 +84,7 @@ abstract class AbstractSerializer * * @throws Exception\DeserializationException For invalid headers. */ - protected static function splitStream(StreamInterface $stream) : array + protected static function splitStream(StreamInterface $stream): array { $headers = []; $currentHeader = false; @@ -108,7 +108,7 @@ abstract class AbstractSerializer } // Append continuation to last header value found - $value = array_pop($headers[$currentHeader]); + $value = array_pop($headers[$currentHeader]); $headers[$currentHeader][] = $value . ' ' . trim($line, "\t "); } @@ -121,7 +121,7 @@ abstract class AbstractSerializer * * @psalm-param array $headers */ - protected static function serializeHeaders(array $headers) : string + protected static function serializeHeaders(array $headers): string { $lines = []; foreach ($headers as $header => $values) { @@ -139,7 +139,7 @@ abstract class AbstractSerializer * * @param string $header */ - protected static function filterHeader($header) : string + protected static function filterHeader($header): string { $filtered = str_replace('-', ' ', $header); $filtered = ucwords($filtered); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php index f908fd00d1..4027e6656a 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php @@ -15,13 +15,10 @@ use const SEEK_SET; */ class CallbackStream implements StreamInterface { - /** - * @var callable|null - */ + /** @var callable|null */ protected $callback; /** - * @param callable $callback * @throws Exception\InvalidArgumentException */ public function __construct(callable $callback) @@ -32,7 +29,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function __toString() : string + public function __toString(): string { return $this->getContents(); } @@ -40,18 +37,19 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function close() : void + public function close(): void { $this->callback = null; } /** * {@inheritdoc} + * * @return null|callable */ - public function detach() : ?callable + public function detach(): ?callable { - $callback = $this->callback; + $callback = $this->callback; $this->callback = null; return $callback; } @@ -59,7 +57,7 @@ class CallbackStream implements StreamInterface /** * Attach a new callback to the instance. */ - public function attach(callable $callback) : void + public function attach(callable $callback): void { $this->callback = $callback; } @@ -67,7 +65,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function getSize() : ?int + public function getSize(): ?int { return null; } @@ -75,7 +73,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function tell() : int + public function tell(): int { throw Exception\UntellableStreamException::forCallbackStream(); } @@ -83,7 +81,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function eof() : bool + public function eof(): bool { return empty($this->callback); } @@ -91,13 +89,14 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function isSeekable() : bool + public function isSeekable(): bool { return false; } /** * {@inheritdoc} + * * @param int $offset * @param int $whence * @return void @@ -110,7 +109,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function rewind() : void + public function rewind(): void { throw Exception\UnrewindableStreamException::forCallbackStream(); } @@ -118,7 +117,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function isWritable() : bool + public function isWritable(): bool { return false; } @@ -126,7 +125,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function write($string) : void + public function write($string): void { throw Exception\UnwritableStreamException::forCallbackStream(); } @@ -134,7 +133,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function isReadable() : bool + public function isReadable(): bool { return false; } @@ -142,7 +141,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function read($length) : string + public function read($length): string { throw Exception\UnreadableStreamException::forCallbackStream(); } @@ -150,7 +149,7 @@ class CallbackStream implements StreamInterface /** * {@inheritdoc} */ - public function getContents() : string + public function getContents(): string { $callback = $this->detach(); $contents = $callback ? $callback() : ''; @@ -163,9 +162,9 @@ class CallbackStream implements StreamInterface public function getMetadata($key = null) { $metadata = [ - 'eof' => $this->eof(), + 'eof' => $this->eof(), 'stream_type' => 'callback', - 'seekable' => false + 'seekable' => false, ]; if (null === $key) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php index 78afa0474e..ae4e96f452 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php @@ -4,17 +4,17 @@ declare(strict_types=1); namespace Laminas\Diactoros; -use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; use Psr\Http\Message\UploadedFileFactoryInterface; use Psr\Http\Message\UriFactoryInterface; class ConfigProvider { - public const CONFIG_KEY = 'laminas-diactoros'; - public const X_FORWARDED = 'x-forwarded-request-filter'; + public const CONFIG_KEY = 'laminas-diactoros'; + public const X_FORWARDED = 'x-forwarded-request-filter'; public const X_FORWARDED_TRUSTED_PROXIES = 'trusted-proxies'; public const X_FORWARDED_TRUSTED_HEADERS = 'trusted-headers'; @@ -23,10 +23,10 @@ class ConfigProvider * * @return array */ - public function __invoke() : array + public function __invoke(): array { return [ - 'dependencies' => $this->getDependencies(), + 'dependencies' => $this->getDependencies(), self::CONFIG_KEY => $this->getComponentConfig(), ]; } @@ -35,7 +35,7 @@ class ConfigProvider * Returns the container dependencies. * Maps factory interfaces to factories. */ - public function getDependencies() : array + public function getDependencies(): array { // @codingStandardsIgnoreStart return [ diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php index 61f5c7c63b..424e34710c 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php @@ -9,37 +9,37 @@ use UnexpectedValueException; class DeserializationException extends UnexpectedValueException implements ExceptionInterface { - public static function forInvalidHeader() : self + public static function forInvalidHeader(): self { throw new self('Invalid header detected'); } - public static function forInvalidHeaderContinuation() : self + public static function forInvalidHeaderContinuation(): self { throw new self('Invalid header continuation'); } - public static function forRequestFromArray(Throwable $previous) : self + public static function forRequestFromArray(Throwable $previous): self { return new self('Cannot deserialize request', $previous->getCode(), $previous); } - public static function forResponseFromArray(Throwable $previous) : self + public static function forResponseFromArray(Throwable $previous): self { return new self('Cannot deserialize response', $previous->getCode(), $previous); } - public static function forUnexpectedCarriageReturn() : self + public static function forUnexpectedCarriageReturn(): self { throw new self('Unexpected carriage return detected'); } - public static function forUnexpectedEndOfHeaders() : self + public static function forUnexpectedEndOfHeaders(): self { throw new self('Unexpected end of headers'); } - public static function forUnexpectedLineFeed() : self + public static function forUnexpectedLineFeed(): self { throw new self('Unexpected line feed detected'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php index 1c446439f9..219bc3ef9f 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidForwardedHeaderNameException.php @@ -6,6 +6,12 @@ namespace Laminas\Diactoros\Exception; use Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders; +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function sprintf; + class InvalidForwardedHeaderNameException extends RuntimeException implements ExceptionInterface { /** @param mixed $name */ diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php index 3c8a68d29c..56cbdeb696 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidProxyAddressException.php @@ -4,6 +4,11 @@ declare(strict_types=1); namespace Laminas\Diactoros\Exception; +use function get_class; +use function gettype; +use function is_object; +use function sprintf; + class InvalidProxyAddressException extends RuntimeException implements ExceptionInterface { /** @param mixed $proxy */ diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php index 6c54d0f572..245a2a5454 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php @@ -9,10 +9,11 @@ use Throwable; class InvalidStreamPointerPositionException extends RuntimeException implements ExceptionInterface { + /** {@inheritDoc} */ public function __construct( string $message = 'Invalid pointer position', - $code = 0, - Throwable $previous = null + int $code = 0, + ?Throwable $previous = null ) { parent::__construct($message, $code, $previous); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/SerializationException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/SerializationException.php index 7e831a3c0e..fc2b6f09c6 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/SerializationException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/SerializationException.php @@ -8,12 +8,12 @@ use UnexpectedValueException; class SerializationException extends UnexpectedValueException implements ExceptionInterface { - public static function forInvalidRequestLine() : self + public static function forInvalidRequestLine(): self { return new self('Invalid request line detected'); } - public static function forInvalidStatusLine() : self + public static function forInvalidStatusLine(): self { return new self('No status line detected'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php index daca665020..212ac7e1ec 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php @@ -8,22 +8,22 @@ use RuntimeException; class UnreadableStreamException extends RuntimeException implements ExceptionInterface { - public static function dueToConfiguration() : self + public static function dueToConfiguration(): self { return new self('Stream is not readable'); } - public static function dueToMissingResource() : self + public static function dueToMissingResource(): self { return new self('No resource available; cannot read'); } - public static function dueToPhpError() : self + public static function dueToPhpError(): self { return new self('Error reading stream'); } - public static function forCallbackStream() : self + public static function forCallbackStream(): self { return new self('Callback streams cannot read'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php index 76d6f2b2b3..475fdcb4cb 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php @@ -10,7 +10,7 @@ use function sprintf; class UnrecognizedProtocolVersionException extends UnexpectedValueException implements ExceptionInterface { - public static function forVersion(string $version) : self + public static function forVersion(string $version): self { return new self(sprintf('Unrecognized protocol version (%s)', $version)); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php index a333008076..0d1d5aeb28 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php @@ -8,7 +8,7 @@ use RuntimeException; class UnrewindableStreamException extends RuntimeException implements ExceptionInterface { - public static function forCallbackStream() : self + public static function forCallbackStream(): self { return new self('Callback streams cannot rewind position'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php index 46c2af6dd6..0bb7cebc9e 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php @@ -8,22 +8,22 @@ use RuntimeException; class UnseekableStreamException extends RuntimeException implements ExceptionInterface { - public static function dueToConfiguration() : self + public static function dueToConfiguration(): self { return new self('Stream is not seekable'); } - public static function dueToMissingResource() : self + public static function dueToMissingResource(): self { return new self('No resource available; cannot seek position'); } - public static function dueToPhpError() : self + public static function dueToPhpError(): self { return new self('Error seeking within stream'); } - public static function forCallbackStream() : self + public static function forCallbackStream(): self { return new self('Callback streams cannot seek position'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php index ec1e9239f5..c66fd25a10 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php @@ -8,17 +8,17 @@ use RuntimeException; class UntellableStreamException extends RuntimeException implements ExceptionInterface { - public static function dueToMissingResource() : self + public static function dueToMissingResource(): self { return new self('No resource available; cannot tell position'); } - public static function dueToPhpError() : self + public static function dueToPhpError(): self { return new self('Error occurred during tell operation'); } - public static function forCallbackStream() : self + public static function forCallbackStream(): self { return new self('Callback streams cannot tell position'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php index 30fbfdf3cc..13b7e37667 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php @@ -8,22 +8,22 @@ use RuntimeException; class UnwritableStreamException extends RuntimeException implements ExceptionInterface { - public static function dueToConfiguration() : self + public static function dueToConfiguration(): self { return new self('Stream is not writable'); } - public static function dueToMissingResource() : self + public static function dueToMissingResource(): self { return new self('No resource available; cannot write'); } - public static function dueToPhpError() : self + public static function dueToPhpError(): self { return new self('Error writing to stream'); } - public static function forCallbackStream() : self + public static function forCallbackStream(): self { return new self('Callback streams cannot write'); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php index 8571597a12..0e65d24c4a 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php @@ -9,10 +9,11 @@ use Throwable; class UploadedFileAlreadyMovedException extends RuntimeException implements ExceptionInterface { + /** {@inheritDoc} */ public function __construct( string $message = 'Cannot retrieve stream after it has already moved', - $code = 0, - Throwable $previous = null + int $code = 0, + ?Throwable $previous = null ) { parent::__construct($message, $code, $previous); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php index b3a3e68e17..7c416132f5 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php @@ -10,12 +10,12 @@ use function sprintf; class UploadedFileErrorException extends RuntimeException implements ExceptionInterface { - public static function forUnmovableFile() : self + public static function forUnmovableFile(): self { return new self('Error occurred while moving uploaded file'); } - public static function dueToStreamUploadError(string $error) : self + public static function dueToStreamUploadError(string $error): self { return new self(sprintf( 'Cannot retrieve stream due to upload error: %s', @@ -23,15 +23,15 @@ class UploadedFileErrorException extends RuntimeException implements ExceptionIn )); } - public static function dueToUnwritablePath() : self + public static function dueToUnwritablePath(): self { return new self('Unable to write to designated path'); } - public static function dueToUnwritableTarget(string $targetDirectory) : self + public static function dueToUnwritableTarget(string $targetDirectory): self { return new self(sprintf( - 'The target directory `%s` does not exists or is not writable', + 'The target directory `%s` does not exist or is not writable', $targetDirectory )); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/HeaderSecurity.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/HeaderSecurity.php index 2fedc61fbb..69a252543e 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/HeaderSecurity.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/HeaderSecurity.php @@ -17,17 +17,12 @@ use function strlen; /** * Provide security tools around HTTP headers to prevent common injection vectors. - * - * Code is largely lifted from the Laminas\Http\Header\HeaderValue implementation in - * Laminas, released with the copyright and license below. - * - * @copyright Copyright (c) 2005-2015 Laminas (https://www.zend.com) - * @license https://getlaminas.org/license/new-bsd New BSD License */ final class HeaderSecurity { /** * Private constructor; non-instantiable. + * * @codeCoverageIgnore */ private function __construct() @@ -48,7 +43,7 @@ final class HeaderSecurity * * @see http://en.wikipedia.org/wiki/HTTP_response_splitting */ - public static function filter(string $value) : string + public static function filter(string $value): string { $length = strlen($value); $string = ''; @@ -61,7 +56,7 @@ final class HeaderSecurity $ws = ord($value[$i + 2]); if ($lf === 10 && in_array($ws, [9, 32], true)) { $string .= $value[$i] . $value[$i + 1]; - $i += 1; + $i += 1; } continue; @@ -72,7 +67,8 @@ final class HeaderSecurity // 32-126, 128-254 === visible // 127 === DEL // 255 === null byte - if (($ascii < 32 && $ascii !== 9) + if ( + ($ascii < 32 && $ascii !== 9) || $ascii === 127 || $ascii > 254 ) { @@ -92,12 +88,13 @@ final class HeaderSecurity * tabs are allowed in values; header continuations MUST consist of * a single CRLF sequence followed by a space or horizontal tab. * - * @param string|int|float $value * @see http://en.wikipedia.org/wiki/HTTP_response_splitting + * + * @param string|int|float $value */ - public static function isValid($value) : bool + public static function isValid($value): bool { - $value = (string) $value; + $value = (string) $value; // Look for: // \n not preceded by \r, OR @@ -125,14 +122,14 @@ final class HeaderSecurity * Assert a header value is valid. * * @param mixed $value Value to be tested. This method asserts it is a string or number. - * @throws Exception\InvalidArgumentException for invalid values + * @throws Exception\InvalidArgumentException For invalid values. */ - public static function assertValid($value) : void + public static function assertValid($value): void { if (! is_string($value) && ! is_numeric($value)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid header value type; must be a string or numeric; received %s', - (is_object($value) ? get_class($value) : gettype($value)) + is_object($value) ? get_class($value) : gettype($value) )); } if (! self::isValid($value)) { @@ -147,15 +144,16 @@ final class HeaderSecurity * Assert whether or not a header name is valid. * * @see http://tools.ietf.org/html/rfc7230#section-3.2 + * * @param mixed $name * @throws Exception\InvalidArgumentException */ - public static function assertValidName($name) : void + public static function assertValidName($name): void { if (! is_string($name)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid header name type; expected string; received %s', - (is_object($name) ? get_class($name) : gettype($name)) + is_object($name) ? get_class($name) : gettype($name) )); } if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/MessageTrait.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/MessageTrait.php index b80599bc28..60f9239386 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/MessageTrait.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/MessageTrait.php @@ -9,6 +9,7 @@ use Psr\Http\Message\StreamInterface; use function array_map; use function array_merge; +use function array_values; use function get_class; use function gettype; use function implode; @@ -33,7 +34,6 @@ trait MessageTrait * List of all registered headers, as key => array of values. * * @var array - * * @psalm-var array> */ protected $headers = []; @@ -42,19 +42,14 @@ trait MessageTrait * Map of normalized header name to original name used to register header. * * @var array - * * @psalm-var array */ protected $headerNames = []; - /** - * @var string - */ + /** @var string */ private $protocol = '1.1'; - /** - * @var StreamInterface - */ + /** @var StreamInterface */ private $stream; /** @@ -64,7 +59,7 @@ trait MessageTrait * * @return string HTTP protocol version. */ - public function getProtocolVersion() : string + public function getProtocolVersion(): string { return $this->protocol; } @@ -82,10 +77,10 @@ trait MessageTrait * @param string $version HTTP protocol version * @return static */ - public function withProtocolVersion($version) : MessageInterface + public function withProtocolVersion($version): MessageInterface { $this->validateProtocolVersion($version); - $new = clone $this; + $new = clone $this; $new->protocol = $version; return $new; } @@ -110,10 +105,9 @@ trait MessageTrait * * @return array Returns an associative array of the message's headers. Each * key MUST be a header name, and each value MUST be an array of strings. - * * @psalm-return array> */ - public function getHeaders() : array + public function getHeaders(): array { return $this->headers; } @@ -126,7 +120,7 @@ trait MessageTrait * name using a case-insensitive string comparison. Returns false if * no matching header name is found in the message. */ - public function hasHeader($header) : bool + public function hasHeader($header): bool { return isset($this->headerNames[strtolower($header)]); } @@ -145,7 +139,7 @@ trait MessageTrait * header. If the header does not appear in the message, this method MUST * return an empty array. */ - public function getHeader($header) : array + public function getHeader($header): array { if (! $this->hasHeader($header)) { return []; @@ -175,7 +169,7 @@ trait MessageTrait * concatenated together using a comma. If the header does not appear in * the message, this method MUST return an empty string. */ - public function getHeaderLine($name) : string + public function getHeaderLine($name): string { $value = $this->getHeader($name); if (empty($value)) { @@ -199,9 +193,9 @@ trait MessageTrait * @param string $name Case-insensitive header field name. * @param string|string[] $value Header value(s). * @return static - * @throws Exception\InvalidArgumentException for invalid header names or values. + * @throws Exception\InvalidArgumentException For invalid header names or values. */ - public function withHeader($name, $value) : MessageInterface + public function withHeader($name, $value): MessageInterface { $this->assertHeader($name); @@ -235,9 +229,9 @@ trait MessageTrait * @param string $name Case-insensitive header field name to add. * @param string|string[] $value Header value(s). * @return static - * @throws Exception\InvalidArgumentException for invalid header names or values. + * @throws Exception\InvalidArgumentException For invalid header names or values. */ - public function withAddedHeader($name, $value) : MessageInterface + public function withAddedHeader($name, $value): MessageInterface { $this->assertHeader($name); @@ -247,8 +241,8 @@ trait MessageTrait $header = $this->headerNames[strtolower($name)]; - $new = clone $this; - $value = $this->filterHeaderValue($value); + $new = clone $this; + $value = $this->filterHeaderValue($value); $new->headers[$header] = array_merge($this->headers[$header], $value); return $new; } @@ -265,7 +259,7 @@ trait MessageTrait * @param string $name Case-insensitive header field name to remove. * @return static */ - public function withoutHeader($name) : MessageInterface + public function withoutHeader($name): MessageInterface { if (! is_string($name) || $name === '' || ! $this->hasHeader($name)) { return clone $this; @@ -284,7 +278,7 @@ trait MessageTrait * * @return StreamInterface Returns the body as a stream. */ - public function getBody() : StreamInterface + public function getBody(): StreamInterface { return $this->stream; } @@ -302,14 +296,15 @@ trait MessageTrait * @return static * @throws Exception\InvalidArgumentException When the body is not valid. */ - public function withBody(StreamInterface $body) : MessageInterface + public function withBody(StreamInterface $body): MessageInterface { - $new = clone $this; + $new = clone $this; $new->stream = $body; return $new; } - private function getStream($stream, string $modeIfNotInstance) : StreamInterface + /** @param StreamInterface|string|resource $stream */ + private function getStream($stream, string $modeIfNotInstance): StreamInterface { if ($stream instanceof StreamInterface) { return $stream; @@ -333,7 +328,7 @@ trait MessageTrait * * @param array $originalHeaders Headers to filter. */ - private function setHeaders(array $originalHeaders) : void + private function setHeaders(array $originalHeaders): void { $headerNames = $headers = []; @@ -343,20 +338,20 @@ trait MessageTrait $this->assertHeader($header); $headerNames[strtolower($header)] = $header; - $headers[$header] = $value; + $headers[$header] = $value; } $this->headerNames = $headerNames; - $this->headers = $headers; + $this->headers = $headers; } /** * Validate the HTTP protocol version * * @param string $version - * @throws Exception\InvalidArgumentException on invalid HTTP protocol version + * @throws Exception\InvalidArgumentException On invalid HTTP protocol version. */ - private function validateProtocolVersion($version) : void + private function validateProtocolVersion($version): void { if (empty($version)) { throw new Exception\InvalidArgumentException( @@ -366,7 +361,7 @@ trait MessageTrait if (! is_string($version)) { throw new Exception\InvalidArgumentException(sprintf( 'Unsupported HTTP protocol version; must be a string, received %s', - (is_object($version) ? get_class($version) : gettype($version)) + is_object($version) ? get_class($version) : gettype($version) )); } @@ -384,7 +379,7 @@ trait MessageTrait * @param mixed $values * @return string[] */ - private function filterHeaderValue($values) : array + private function filterHeaderValue($values): array { if (! is_array($values)) { $values = [$values]; @@ -400,7 +395,7 @@ trait MessageTrait return array_map(function ($value) { HeaderSecurity::assertValid($value); - $value = (string)$value; + $value = (string) $value; // Normalize line folding to a single space (RFC 7230#3.2.4). $value = str_replace(["\r\n\t", "\r\n "], ' ', $value); @@ -414,10 +409,9 @@ trait MessageTrait * Ensure header name and values are valid. * * @param string $name - * * @throws Exception\InvalidArgumentException */ - private function assertHeader($name) : void + private function assertHeader($name): void { HeaderSecurity::assertValidName($name); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php index 876f91f4b5..47a94b9e0f 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php @@ -11,14 +11,10 @@ use function stream_get_contents; */ class PhpInputStream extends Stream { - /** - * @var string - */ + /** @var string */ private $cache = ''; - /** - * @var bool - */ + /** @var bool */ private $reachedEof = false; /** @@ -32,7 +28,7 @@ class PhpInputStream extends Stream /** * {@inheritdoc} */ - public function __toString() : string + public function __toString(): string { if ($this->reachedEof) { return $this->cache; @@ -45,7 +41,7 @@ class PhpInputStream extends Stream /** * {@inheritdoc} */ - public function isWritable() : bool + public function isWritable(): bool { return false; } @@ -53,7 +49,7 @@ class PhpInputStream extends Stream /** * {@inheritdoc} */ - public function read($length) : string + public function read($length): string { $content = parent::read($length); if (! $this->reachedEof) { @@ -70,7 +66,7 @@ class PhpInputStream extends Stream /** * {@inheritdoc} */ - public function getContents($maxLength = -1) : string + public function getContents($maxLength = -1): string { if ($this->reachedEof) { return $this->cache; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php index 993a266da9..3f91e285c9 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php @@ -9,40 +9,29 @@ use Psr\Http\Message\StreamInterface; use const SEEK_SET; /** - * Class RelativeStream - * * Wrapper for default Stream class, representing subpart (starting from given offset) of initial stream. * It can be used to avoid copying full stream, conserving memory. - * @example see Laminas\Diactoros\AbstractSerializer::splitStream() + * + * @see AbstractSerializer::splitStream() */ final class RelativeStream implements StreamInterface { - /** - * @var StreamInterface - */ + /** @var StreamInterface */ private $decoratedStream; - /** - * @var int - */ + /** @var int */ private $offset; - /** - * Class constructor - * - * @param StreamInterface $decoratedStream - * @param int $offset - */ public function __construct(StreamInterface $decoratedStream, ?int $offset) { $this->decoratedStream = $decoratedStream; - $this->offset = (int) $offset; + $this->offset = (int) $offset; } /** * {@inheritdoc} */ - public function __toString() : string + public function __toString(): string { if ($this->isSeekable()) { $this->seek(0); @@ -53,7 +42,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function close() : void + public function close(): void { $this->decoratedStream->close(); } @@ -69,7 +58,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function getSize() : int + public function getSize(): int { return $this->decoratedStream->getSize() - $this->offset; } @@ -77,7 +66,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function tell() : int + public function tell(): int { return $this->decoratedStream->tell() - $this->offset; } @@ -85,7 +74,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function eof() : bool + public function eof(): bool { return $this->decoratedStream->eof(); } @@ -93,7 +82,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function isSeekable() : bool + public function isSeekable(): bool { return $this->decoratedStream->isSeekable(); } @@ -101,9 +90,9 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function seek($offset, $whence = SEEK_SET) : void + public function seek($offset, $whence = SEEK_SET): void { - if ($whence == SEEK_SET) { + if ($whence === SEEK_SET) { $this->decoratedStream->seek($offset + $this->offset, $whence); return; } @@ -113,7 +102,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function rewind() : void + public function rewind(): void { $this->seek(0); } @@ -121,7 +110,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function isWritable() : bool + public function isWritable(): bool { return $this->decoratedStream->isWritable(); } @@ -129,7 +118,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function write($string) : int + public function write($string): int { if ($this->tell() < 0) { throw new Exception\InvalidStreamPointerPositionException(); @@ -140,7 +129,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function isReadable() : bool + public function isReadable(): bool { return $this->decoratedStream->isReadable(); } @@ -148,7 +137,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function read($length) : string + public function read($length): string { if ($this->tell() < 0) { throw new Exception\InvalidStreamPointerPositionException(); @@ -159,7 +148,7 @@ final class RelativeStream implements StreamInterface /** * {@inheritdoc} */ - public function getContents() : string + public function getContents(): string { if ($this->tell() < 0) { throw new Exception\InvalidStreamPointerPositionException(); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php index 1805cdf7f7..504581c201 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php @@ -26,9 +26,9 @@ class Request implements RequestInterface * @param null|string $method HTTP method for the request, if any. * @param string|resource|StreamInterface $body Message body, if any. * @param array $headers Headers for the message, if any. - * @throws Exception\InvalidArgumentException for any invalid value. + * @throws Exception\InvalidArgumentException For any invalid value. */ - public function __construct($uri = null, string $method = null, $body = 'php://temp', array $headers = []) + public function __construct($uri = null, ?string $method = null, $body = 'php://temp', array $headers = []) { $this->initialize($uri, $method, $body, $headers); } @@ -36,10 +36,11 @@ class Request implements RequestInterface /** * {@inheritdoc} */ - public function getHeaders() : array + public function getHeaders(): array { $headers = $this->headers; - if (! $this->hasHeader('host') + if ( + ! $this->hasHeader('host') && $this->uri->getHost() ) { $headers['Host'] = [$this->getHostFromUri()]; @@ -51,10 +52,11 @@ class Request implements RequestInterface /** * {@inheritdoc} */ - public function getHeader($name) : array + public function getHeader($name): array { if (empty($name) || ! $this->hasHeader($name)) { - if (strtolower($name) === 'host' + if ( + strtolower($name) === 'host' && $this->uri->getHost() ) { return [$this->getHostFromUri()]; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php index 92cfff348a..e3c10485fb 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php @@ -23,8 +23,17 @@ final class ArraySerializer { /** * Serialize a request message to an array. + * + * @return array{ + * method: string, + * request_target: string, + * uri: string, + * protocol_version: string, + * headers: array>, + * body: string + * } */ - public static function toArray(RequestInterface $request) : array + public static function toArray(RequestInterface $request): array { return [ 'method' => $request->getMethod(), @@ -39,14 +48,14 @@ final class ArraySerializer /** * Deserialize a request array to a request instance. * - * @throws Exception\DeserializationException when cannot deserialize response + * @throws Exception\DeserializationException When the response cannot be deserialized. */ - public static function fromArray(array $serializedRequest) : Request + public static function fromArray(array $serializedRequest): Request { try { - $uri = self::getValueFromKey($serializedRequest, 'uri'); - $method = self::getValueFromKey($serializedRequest, 'method'); - $body = new Stream('php://memory', 'wb+'); + $uri = self::getValueFromKey($serializedRequest, 'uri'); + $method = self::getValueFromKey($serializedRequest, 'method'); + $body = new Stream('php://memory', 'wb+'); $body->write(self::getValueFromKey($serializedRequest, 'body')); $headers = self::getValueFromKey($serializedRequest, 'headers'); $requestTarget = self::getValueFromKey($serializedRequest, 'request_target'); @@ -64,7 +73,7 @@ final class ArraySerializer * @return mixed * @throws Exception\DeserializationException */ - private static function getValueFromKey(array $data, string $key, string $message = null) + private static function getValueFromKey(array $data, string $key, ?string $message = null) { if (isset($data[$key])) { return $data[$key]; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php index 3033be23f8..b6faf114bd 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php @@ -29,9 +29,9 @@ final class Serializer extends AbstractSerializer * * Internally, casts the message to a stream and invokes fromStream(). * - * @throws Exception\SerializationException when errors occur parsing the message. + * @throws Exception\SerializationException When errors occur parsing the message. */ - public static function fromString(string $message) : Request + public static function fromString(string $message): Request { $stream = new Stream('php://temp', 'wb+'); $stream->write($message); @@ -41,11 +41,10 @@ final class Serializer extends AbstractSerializer /** * Deserialize a request stream to a request instance. * - * @throws Exception\InvalidArgumentException if the message stream is not - * readable or seekable. - * @throws Exception\SerializationException if an invalid request line is detected. + * @throws Exception\InvalidArgumentException If the message stream is not readable or seekable. + * @throws Exception\SerializationException If an invalid request line is detected. */ - public static function fromStream(StreamInterface $stream) : Request + public static function fromStream(StreamInterface $stream): Request { if (! $stream->isReadable() || ! $stream->isSeekable()) { throw new Exception\InvalidArgumentException('Message stream must be both readable and seekable'); @@ -54,7 +53,7 @@ final class Serializer extends AbstractSerializer $stream->rewind(); [$method, $requestTarget, $version] = self::getRequestLine($stream); - $uri = self::createUriFromRequestTarget($requestTarget); + $uri = self::createUriFromRequestTarget($requestTarget); [$headers, $body] = self::splitStream($stream); @@ -66,12 +65,12 @@ final class Serializer extends AbstractSerializer /** * Serialize a request message to a string. */ - public static function toString(RequestInterface $request) : string + public static function toString(RequestInterface $request): string { $httpMethod = $request->getMethod(); - $headers = self::serializeHeaders($request->getHeaders()); - $body = (string) $request->getBody(); - $format = '%s %s HTTP/%s%s%s'; + $headers = self::serializeHeaders($request->getHeaders()); + $body = (string) $request->getBody(); + $format = '%s %s HTTP/%s%s%s'; if (! empty($headers)) { $headers = "\r\n" . $headers; @@ -99,15 +98,17 @@ final class Serializer extends AbstractSerializer * * @throws Exception\SerializationException */ - private static function getRequestLine(StreamInterface $stream) : array + private static function getRequestLine(StreamInterface $stream): array { $requestLine = self::getLine($stream); - if (! preg_match( - '#^(?P[!\#$%&\'*+.^_`|~a-zA-Z0-9-]+) (?P[^\s]+) HTTP/(?P[1-9]\d*\.\d+)$#', - $requestLine, - $matches - )) { + if ( + ! preg_match( + '#^(?P[!\#$%&\'*+.^_`|~a-zA-Z0-9-]+) (?P[^\s]+) HTTP/(?P[1-9]\d*\.\d+)$#', + $requestLine, + $matches + ) + ) { throw Exception\SerializationException::forInvalidRequestLine(); } @@ -121,7 +122,7 @@ final class Serializer extends AbstractSerializer * instance is returned; otherwise, the value is used to create and return * a new Uri instance. */ - private static function createUriFromRequestTarget(string $requestTarget) : Uri + private static function createUriFromRequestTarget(string $requestTarget): Uri { if (preg_match('#^https?://#', $requestTarget)) { return new Uri($requestTarget); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php index 9a6d9a64f0..9632d2770b 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php @@ -12,7 +12,7 @@ class RequestFactory implements RequestFactoryInterface /** * {@inheritDoc} */ - public function createRequest(string $method, $uri) : RequestInterface + public function createRequest(string $method, $uri): RequestInterface { return new Request($uri, $method); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestTrait.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestTrait.php index d22617f6ac..dd4fe6f5d1 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestTrait.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestTrait.php @@ -31,9 +31,7 @@ trait RequestTrait { use MessageTrait; - /** - * @var string - */ + /** @var string */ private $method = 'GET'; /** @@ -43,9 +41,7 @@ trait RequestTrait */ private $requestTarget; - /** - * @var UriInterface - */ + /** @var UriInterface */ private $uri; /** @@ -57,14 +53,14 @@ trait RequestTrait * @param null|string $method HTTP method for the request, if any. * @param string|resource|StreamInterface $body Message body, if any. * @param array $headers Headers for the message, if any. - * @throws Exception\InvalidArgumentException for any invalid value. + * @throws Exception\InvalidArgumentException For any invalid value. */ private function initialize( $uri = null, - string $method = null, + ?string $method = null, $body = 'php://memory', array $headers = [] - ) : void { + ): void { if ($method !== null) { $this->setMethod($method); } @@ -78,7 +74,7 @@ trait RequestTrait // Host header is provided if (! $this->hasHeader('Host') && $this->uri->getHost()) { $this->headerNames['host'] = 'Host'; - $this->headers['Host'] = [$this->getHostFromUri()]; + $this->headers['Host'] = [$this->getHostFromUri()]; } } @@ -97,7 +93,7 @@ trait RequestTrait * @param null|string|UriInterface $uri * @throws Exception\InvalidArgumentException */ - private function createUri($uri) : UriInterface + private function createUri($uri): UriInterface { if ($uri instanceof UriInterface) { return $uri; @@ -127,7 +123,7 @@ trait RequestTrait * If no URI is available, and no request-target has been specifically * provided, this method MUST return the string "/". */ - public function getRequestTarget() : string + public function getRequestTarget(): string { if (null !== $this->requestTarget) { return $this->requestTarget; @@ -159,10 +155,11 @@ trait RequestTrait * * @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various * request-target forms allowed in request messages) + * * @param string $requestTarget - * @throws Exception\InvalidArgumentException if the request target is invalid. + * @throws Exception\InvalidArgumentException If the request target is invalid. */ - public function withRequestTarget($requestTarget) : RequestInterface + public function withRequestTarget($requestTarget): RequestInterface { if (preg_match('#\s#', $requestTarget)) { throw new Exception\InvalidArgumentException( @@ -170,7 +167,7 @@ trait RequestTrait ); } - $new = clone $this; + $new = clone $this; $new->requestTarget = $requestTarget; return $new; } @@ -180,7 +177,7 @@ trait RequestTrait * * @return string Returns the request method. */ - public function getMethod() : string + public function getMethod(): string { return $this->method; } @@ -197,9 +194,9 @@ trait RequestTrait * changed request method. * * @param string $method Case-insensitive method. - * @throws Exception\InvalidArgumentException for invalid HTTP methods. + * @throws Exception\InvalidArgumentException For invalid HTTP methods. */ - public function withMethod($method) : RequestInterface + public function withMethod($method): RequestInterface { $new = clone $this; $new->setMethod($method); @@ -212,10 +209,11 @@ trait RequestTrait * This method MUST return a UriInterface instance. * * @link http://tools.ietf.org/html/rfc3986#section-4.3 + * * @return UriInterface Returns a UriInterface instance * representing the URI of the request, if any. */ - public function getUri() : UriInterface + public function getUri(): UriInterface { return $this->uri; } @@ -241,12 +239,13 @@ trait RequestTrait * new UriInterface instance. * * @link http://tools.ietf.org/html/rfc3986#section-4.3 + * * @param UriInterface $uri New request URI to use. * @param bool $preserveHost Preserve the original state of the Host header. */ - public function withUri(UriInterface $uri, $preserveHost = false) : RequestInterface + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface { - $new = clone $this; + $new = clone $this; $new->uri = $uri; if ($preserveHost && $this->hasHeader('Host')) { @@ -282,9 +281,9 @@ trait RequestTrait * Set and validate the HTTP method * * @param string $method - * @throws Exception\InvalidArgumentException on invalid HTTP method. + * @throws Exception\InvalidArgumentException On invalid HTTP method. */ - private function setMethod($method) : void + private function setMethod($method): void { if (! is_string($method)) { throw new Exception\InvalidArgumentException(sprintf( @@ -305,7 +304,7 @@ trait RequestTrait /** * Retrieve the host from the URI instance */ - private function getHostFromUri() : string + private function getHostFromUri(): string { $host = $this->uri->getHost(); $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : ''; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php index e7235824e3..ef01e02055 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php @@ -7,10 +7,13 @@ namespace Laminas\Diactoros; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; +use function get_class; use function gettype; use function is_float; use function is_numeric; +use function is_object; use function is_scalar; +use function is_string; use function sprintf; /** @@ -31,7 +34,6 @@ class Response implements ResponseInterface * Map of standard HTTP status code/reason phrases * * @var array - * * @psalm-var array */ private $phrases = [ @@ -108,21 +110,17 @@ class Response implements ResponseInterface 599 => 'Network Connect Timeout Error', ]; - /** - * @var string - */ + /** @var string */ private $reasonPhrase; - /** - * @var int - */ + /** @var int */ private $statusCode; /** * @param string|resource|StreamInterface $body Stream identifier and/or actual stream resource * @param int $status Status code for the response, if any. * @param array $headers Headers for the response, if any. - * @throws Exception\InvalidArgumentException on any invalid element. + * @throws Exception\InvalidArgumentException On any invalid element. */ public function __construct($body = 'php://memory', int $status = 200, array $headers = []) { @@ -134,7 +132,7 @@ class Response implements ResponseInterface /** * {@inheritdoc} */ - public function getStatusCode() : int + public function getStatusCode(): int { return $this->statusCode; } @@ -142,7 +140,7 @@ class Response implements ResponseInterface /** * {@inheritdoc} */ - public function getReasonPhrase() : string + public function getReasonPhrase(): string { return $this->reasonPhrase; } @@ -150,7 +148,7 @@ class Response implements ResponseInterface /** * {@inheritdoc} */ - public function withStatus($code, $reasonPhrase = '') : Response + public function withStatus($code, $reasonPhrase = ''): Response { $new = clone $this; $new->setStatusCode($code, $reasonPhrase); @@ -162,11 +160,12 @@ class Response implements ResponseInterface * * @param int $code * @param string $reasonPhrase - * @throws Exception\InvalidArgumentException on an invalid status code. + * @throws Exception\InvalidArgumentException On an invalid status code. */ - private function setStatusCode($code, $reasonPhrase = '') : void + private function setStatusCode($code, $reasonPhrase = ''): void { - if (! is_numeric($code) + if ( + ! is_numeric($code) || is_float($code) || $code < static::MIN_STATUS_CODE_VALUE || $code > static::MAX_STATUS_CODE_VALUE @@ -191,6 +190,6 @@ class Response implements ResponseInterface } $this->reasonPhrase = $reasonPhrase; - $this->statusCode = (int) $code; + $this->statusCode = (int) $code; } } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php index 462458dc24..b3ecc111f2 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php @@ -23,8 +23,16 @@ final class ArraySerializer { /** * Serialize a response message to an array. + * + * @return array{ + * status_code: int, + * reason_phrase: string, + * protocol_version: string, + * headers: array>, + * body: string + * } */ - public static function toArray(ResponseInterface $response) : array + public static function toArray(ResponseInterface $response): array { return [ 'status_code' => $response->getStatusCode(), @@ -38,9 +46,9 @@ final class ArraySerializer /** * Deserialize a response array to a response instance. * - * @throws Exception\DeserializationException when cannot deserialize response + * @throws Exception\DeserializationException When cannot deserialize response. */ - public static function fromArray(array $serializedResponse) : Response + public static function fromArray(array $serializedResponse): Response { try { $body = new Stream('php://memory', 'wb+'); @@ -61,12 +69,10 @@ final class ArraySerializer /** * @param array $data - * @param string $key - * @param string $message * @return mixed * @throws Exception\DeserializationException */ - private static function getValueFromKey(array $data, string $key, string $message = null) + private static function getValueFromKey(array $data, string $key, ?string $message = null) { if (isset($data[$key])) { return $data[$key]; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php index 7f082ba3f8..82140e8112 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php @@ -28,9 +28,8 @@ class EmptyResponse extends Response * Create an empty response with the given headers. * * @param array $headers Headers for the response. - * @return EmptyResponse */ - public static function withHeaders(array $headers) : EmptyResponse + public static function withHeaders(array $headers): EmptyResponse { return new static(204, $headers); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/HtmlResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/HtmlResponse.php index e7527a3a21..298b87c3cd 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/HtmlResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/HtmlResponse.php @@ -35,7 +35,7 @@ class HtmlResponse extends Response * @param string|StreamInterface $html HTML or stream for the message body. * @param int $status Integer status code for the response; 200 by default. * @param array $headers Array of headers to use at initialization. - * @throws Exception\InvalidArgumentException if $html is neither a string or stream. + * @throws Exception\InvalidArgumentException If $html is neither a string or stream. */ public function __construct($html, int $status = 200, array $headers = []) { @@ -50,9 +50,9 @@ class HtmlResponse extends Response * Create the message body. * * @param string|StreamInterface $html - * @throws Exception\InvalidArgumentException if $html is neither a string or stream. + * @throws Exception\InvalidArgumentException If $html is neither a string or stream. */ - private function createBody($html) : StreamInterface + private function createBody($html): StreamInterface { if ($html instanceof StreamInterface) { return $html; @@ -61,8 +61,8 @@ class HtmlResponse extends Response if (! is_string($html)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid content (%s) provided to %s', - (is_object($html) ? get_class($html) : gettype($html)), - __CLASS__ + is_object($html) ? get_class($html) : gettype($html), + self::class )); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php index 0a955866a6..c6de0b4c8c 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php @@ -15,10 +15,10 @@ trait InjectContentTypeTrait * * @return array Headers with injected Content-Type */ - private function injectContentType(string $contentType, array $headers) : array + private function injectContentType(string $contentType, array $headers): array { $hasContentType = array_reduce(array_keys($headers), function ($carry, $item) { - return $carry ?: (strtolower($item) === 'content-type'); + return $carry ?: strtolower($item) === 'content-type'; }, false); if (! $hasContentType) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/JsonResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/JsonResponse.php index 84baa9592d..91c79e5c35 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/JsonResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/JsonResponse.php @@ -44,14 +44,10 @@ class JsonResponse extends Response | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES; - /** - * @var mixed - */ + /** @var mixed */ private $payload; - /** - * @var int - */ + /** @var int */ private $encodingOptions; /** @@ -70,7 +66,7 @@ class JsonResponse extends Response * @param int $status Integer status code for the response; 200 by default. * @param array $headers Array of headers to use at initialization. * @param int $encodingOptions JSON encoding options to use. - * @throws Exception\InvalidArgumentException if unable to encode the $data to JSON. + * @throws Exception\InvalidArgumentException If unable to encode the $data to JSON. */ public function __construct( $data, @@ -100,26 +96,26 @@ class JsonResponse extends Response /** * @param mixed $data */ - public function withPayload($data) : JsonResponse + public function withPayload($data): JsonResponse { $new = clone $this; $new->setPayload($data); return $this->updateBodyFor($new); } - public function getEncodingOptions() : int + public function getEncodingOptions(): int { return $this->encodingOptions; } - public function withEncodingOptions(int $encodingOptions) : JsonResponse + public function withEncodingOptions(int $encodingOptions): JsonResponse { - $new = clone $this; + $new = clone $this; $new->encodingOptions = $encodingOptions; return $this->updateBodyFor($new); } - private function createBodyFromJson(string $json) : Stream + private function createBodyFromJson(string $json): Stream { $body = new Stream('php://temp', 'wb+'); $body->write($json); @@ -132,9 +128,9 @@ class JsonResponse extends Response * Encode the provided data to JSON. * * @param mixed $data - * @throws Exception\InvalidArgumentException if unable to encode the $data to JSON. + * @throws Exception\InvalidArgumentException If unable to encode the $data to JSON. */ - private function jsonEncode($data, int $encodingOptions) : string + private function jsonEncode($data, int $encodingOptions): string { if (is_resource($data)) { throw new Exception\InvalidArgumentException('Cannot JSON encode resources'); @@ -148,7 +144,7 @@ class JsonResponse extends Response if (JSON_ERROR_NONE !== json_last_error()) { throw new Exception\InvalidArgumentException(sprintf( 'Unable to encode data to JSON in %s: %s', - __CLASS__, + self::class, json_last_error_msg() )); } @@ -159,7 +155,7 @@ class JsonResponse extends Response /** * @param mixed $data */ - private function setPayload($data) : void + private function setPayload($data): void { if (is_object($data)) { $data = clone $data; @@ -174,7 +170,7 @@ class JsonResponse extends Response * @param self $toUpdate Instance to update. * @return JsonResponse Returns a new instance with an updated body. */ - private function updateBodyFor(JsonResponse $toUpdate) : JsonResponse + private function updateBodyFor(JsonResponse $toUpdate): JsonResponse { $json = $this->jsonEncode($toUpdate->payload, $toUpdate->encodingOptions); $body = $this->createBodyFromJson($json); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php index 9aa784f4e8..e2ec04e2c9 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php @@ -36,7 +36,7 @@ class RedirectResponse extends Response if (! is_string($uri) && ! $uri instanceof UriInterface) { throw new Exception\InvalidArgumentException(sprintf( 'Uri provided to %s MUST be a string or Psr\Http\Message\UriInterface instance; received "%s"', - __CLASS__, + self::class, is_object($uri) ? get_class($uri) : gettype($uri) )); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/Serializer.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/Serializer.php index ed56c180e5..01cceef0e2 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/Serializer.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/Serializer.php @@ -19,9 +19,9 @@ final class Serializer extends AbstractSerializer /** * Deserialize a response string to a response instance. * - * @throws Exception\SerializationException when errors occur parsing the message. + * @throws Exception\SerializationException When errors occur parsing the message. */ - public static function fromString(string $message) : Response + public static function fromString(string $message): Response { $stream = new Stream('php://temp', 'wb+'); $stream->write($message); @@ -31,10 +31,10 @@ final class Serializer extends AbstractSerializer /** * Parse a response from a stream. * - * @throws Exception\InvalidArgumentException when the stream is not readable. - * @throws Exception\SerializationException when errors occur parsing the message. + * @throws Exception\InvalidArgumentException When the stream is not readable. + * @throws Exception\SerializationException When errors occur parsing the message. */ - public static function fromStream(StreamInterface $stream) : Response + public static function fromStream(StreamInterface $stream): Response { if (! $stream->isReadable() || ! $stream->isSeekable()) { throw new Exception\InvalidArgumentException('Message stream must be both readable and seekable'); @@ -53,7 +53,7 @@ final class Serializer extends AbstractSerializer /** * Create a string representation of a response. */ - public static function toString(ResponseInterface $response) : string + public static function toString(ResponseInterface $response): string { $reasonPhrase = $response->getReasonPhrase(); $headers = self::serializeHeaders($response->getHeaders()); @@ -70,7 +70,7 @@ final class Serializer extends AbstractSerializer $format, $response->getProtocolVersion(), $response->getStatusCode(), - ($reasonPhrase ? ' ' . $reasonPhrase : ''), + $reasonPhrase ? ' ' . $reasonPhrase : '', $headers, $body ); @@ -80,17 +80,19 @@ final class Serializer extends AbstractSerializer * Retrieve the status line for the message. * * @return array Array with three elements: 0 => version, 1 => status, 2 => reason - * @throws Exception\SerializationException if line is malformed + * @throws Exception\SerializationException If line is malformed. */ - private static function getStatusLine(StreamInterface $stream) : array + private static function getStatusLine(StreamInterface $stream): array { $line = self::getLine($stream); - if (! preg_match( - '#^HTTP/(?P[1-9]\d*\.\d) (?P[1-5]\d{2})(\s+(?P.+))?$#', - $line, - $matches - )) { + if ( + ! preg_match( + '#^HTTP/(?P[1-9]\d*\.\d) (?P[1-5]\d{2})(\s+(?P.+))?$#', + $line, + $matches + ) + ) { throw Exception\SerializationException::forInvalidStatusLine(); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php index c2120a4ccb..65ee3e083b 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php @@ -35,7 +35,7 @@ class TextResponse extends Response * @param string|StreamInterface $text String or stream for the message body. * @param int $status Integer status code for the response; 200 by default. * @param array $headers Array of headers to use at initialization. - * @throws Exception\InvalidArgumentException if $text is neither a string or stream. + * @throws Exception\InvalidArgumentException If $text is neither a string or stream. */ public function __construct($text, int $status = 200, array $headers = []) { @@ -50,9 +50,9 @@ class TextResponse extends Response * Create the message body. * * @param string|StreamInterface $text - * @throws Exception\InvalidArgumentException if $text is neither a string or stream. + * @throws Exception\InvalidArgumentException If $text is neither a string or stream. */ - private function createBody($text) : StreamInterface + private function createBody($text): StreamInterface { if ($text instanceof StreamInterface) { return $text; @@ -61,8 +61,8 @@ class TextResponse extends Response if (! is_string($text)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid content (%s) provided to %s', - (is_object($text) ? get_class($text) : gettype($text)), - __CLASS__ + is_object($text) ? get_class($text) : gettype($text), + self::class )); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php index 0c4455989d..f0cb0bac8f 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php @@ -34,7 +34,7 @@ class XmlResponse extends Response * @param string|StreamInterface $xml String or stream for the message body. * @param int $status Integer status code for the response; 200 by default. * @param array $headers Array of headers to use at initialization. - * @throws Exception\InvalidArgumentException if $text is neither a string or stream. + * @throws Exception\InvalidArgumentException If $text is neither a string or stream. */ public function __construct( $xml, @@ -52,9 +52,9 @@ class XmlResponse extends Response * Create the message body. * * @param string|StreamInterface $xml - * @throws Exception\InvalidArgumentException if $xml is neither a string or stream. + * @throws Exception\InvalidArgumentException If $xml is neither a string or stream. */ - private function createBody($xml) : StreamInterface + private function createBody($xml): StreamInterface { if ($xml instanceof StreamInterface) { return $xml; @@ -63,8 +63,8 @@ class XmlResponse extends Response if (! is_string($xml)) { throw new Exception\InvalidArgumentException(sprintf( 'Invalid content (%s) provided to %s', - (is_object($xml) ? get_class($xml) : gettype($xml)), - __CLASS__ + is_object($xml) ? get_class($xml) : gettype($xml), + self::class )); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php index 2c0060f713..b605d2dbbd 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php @@ -12,7 +12,7 @@ class ResponseFactory implements ResponseFactoryInterface /** * {@inheritDoc} */ - public function createResponse(int $code = 200, string $reasonPhrase = '') : ResponseInterface + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface { return (new Response()) ->withStatus($code, $reasonPhrase); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php index 313fc05547..7e67f00054 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php @@ -10,7 +10,10 @@ use Psr\Http\Message\UploadedFileInterface; use Psr\Http\Message\UriInterface; use function array_key_exists; +use function gettype; use function is_array; +use function is_object; +use function sprintf; /** * Server-side HTTP request @@ -30,34 +33,22 @@ class ServerRequest implements ServerRequestInterface { use RequestTrait; - /** - * @var array - */ + /** @var array */ private $attributes = []; - /** - * @var array - */ + /** @var array */ private $cookieParams = []; - /** - * @var null|array|object - */ + /** @var null|array|object */ private $parsedBody; - /** - * @var array - */ + /** @var array */ private $queryParams = []; - /** - * @var array - */ + /** @var array */ private $serverParams; - /** - * @var array - */ + /** @var array */ private $uploadedFiles; /** @@ -71,13 +62,13 @@ class ServerRequest implements ServerRequestInterface * @param array $queryParams Query params for the message, if any. * @param null|array|object $parsedBody The deserialized body parameters, if any. * @param string $protocol HTTP protocol version. - * @throws Exception\InvalidArgumentException for any invalid value. + * @throws Exception\InvalidArgumentException For any invalid value. */ public function __construct( array $serverParams = [], array $uploadedFiles = [], $uri = null, - string $method = null, + ?string $method = null, $body = 'php://input', array $headers = [], array $cookies = [], @@ -103,7 +94,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function getServerParams() : array + public function getServerParams(): array { return $this->serverParams; } @@ -111,7 +102,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function getUploadedFiles() : array + public function getUploadedFiles(): array { return $this->uploadedFiles; } @@ -119,10 +110,10 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withUploadedFiles(array $uploadedFiles) : ServerRequest + public function withUploadedFiles(array $uploadedFiles): ServerRequest { $this->validateUploadedFiles($uploadedFiles); - $new = clone $this; + $new = clone $this; $new->uploadedFiles = $uploadedFiles; return $new; } @@ -130,7 +121,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function getCookieParams() : array + public function getCookieParams(): array { return $this->cookieParams; } @@ -138,9 +129,9 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withCookieParams(array $cookies) : ServerRequest + public function withCookieParams(array $cookies): ServerRequest { - $new = clone $this; + $new = clone $this; $new->cookieParams = $cookies; return $new; } @@ -148,7 +139,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function getQueryParams() : array + public function getQueryParams(): array { return $this->queryParams; } @@ -156,9 +147,9 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withQueryParams(array $query) : ServerRequest + public function withQueryParams(array $query): ServerRequest { - $new = clone $this; + $new = clone $this; $new->queryParams = $query; return $new; } @@ -174,7 +165,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withParsedBody($data) : ServerRequest + public function withParsedBody($data): ServerRequest { if (! is_array($data) && ! is_object($data) && null !== $data) { throw new Exception\InvalidArgumentException(sprintf( @@ -184,7 +175,7 @@ class ServerRequest implements ServerRequestInterface )); } - $new = clone $this; + $new = clone $this; $new->parsedBody = $data; return $new; } @@ -192,7 +183,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function getAttributes() : array + public function getAttributes(): array { return $this->attributes; } @@ -212,9 +203,9 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withAttribute($attribute, $value) : ServerRequest + public function withAttribute($attribute, $value): ServerRequest { - $new = clone $this; + $new = clone $this; $new->attributes[$attribute] = $value; return $new; } @@ -222,7 +213,7 @@ class ServerRequest implements ServerRequestInterface /** * {@inheritdoc} */ - public function withoutAttribute($name) : ServerRequest + public function withoutAttribute($name): ServerRequest { $new = clone $this; unset($new->attributes[$name]); @@ -232,9 +223,9 @@ class ServerRequest implements ServerRequestInterface /** * Recursively validate the structure in an uploaded files array. * - * @throws Exception\InvalidArgumentException if any leaf is not an UploadedFileInterface instance. + * @throws Exception\InvalidArgumentException If any leaf is not an UploadedFileInterface instance. */ - private function validateUploadedFiles(array $uploadedFiles) : void + private function validateUploadedFiles(array $uploadedFiles): void { foreach ($uploadedFiles as $file) { if (is_array($file)) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php index 30eb71cbe0..4d74bf3c79 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php @@ -9,16 +9,29 @@ use Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders; use Psr\Http\Message\ServerRequestFactoryInterface; use Psr\Http\Message\ServerRequestInterface; +use function array_change_key_case; use function array_key_exists; +use function explode; +use function gettype; +use function implode; +use function is_array; +use function is_bool; use function is_callable; +use function is_string; +use function ltrim; +use function preg_match; +use function preg_replace; +use function sprintf; +use function strlen; +use function strpos; +use function strrpos; +use function strtolower; +use function substr; + +use const CASE_LOWER; /** * Class for marshaling a request object from the current PHP environment. - * - * Logic largely refactored from the Laminas Laminas\Http\PhpEnvironment\Request class. - * - * @copyright Copyright (c) 2005-2015 Laminas (https://www.zend.com) - * @license https://getlaminas.org/license/new-bsd New BSD License */ class ServerRequestFactory implements ServerRequestFactoryInterface { @@ -39,6 +52,7 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * order to marshal the request URI and headers. * * @see fromServer() + * * @param array $server $_SERVER superglobal * @param array $query $_GET superglobal * @param array $body $_POST superglobal @@ -49,19 +63,18 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * returned by this method. When not present, a default instance of * FilterUsingXForwardedHeaders is created, using the `trustReservedSubnets()` * constructor. - * @return ServerRequest */ public static function fromGlobals( - array $server = null, - array $query = null, - array $body = null, - array $cookies = null, - array $files = null, + ?array $server = null, + ?array $query = null, + ?array $body = null, + ?array $cookies = null, + ?array $files = null, ?FilterServerRequestInterface $requestFilter = null - ) : ServerRequest { + ): ServerRequest { $requestFilter = $requestFilter ?: FilterUsingXForwardedHeaders::trustReservedSubnets(); - $server = normalizeServer( + $server = normalizeServer( $server ?: $_SERVER, is_callable(self::$apacheRequestHeaders) ? self::$apacheRequestHeaders : null ); @@ -89,7 +102,7 @@ class ServerRequestFactory implements ServerRequestFactoryInterface /** * {@inheritDoc} */ - public function createServerRequest(string $method, $uri, array $serverParams = []) : ServerRequestInterface + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface { $uploadedFiles = []; @@ -108,12 +121,12 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * @param array> $headers * @param array $server SAPI parameters */ - private static function marshalUriFromSapi(array $server, array $headers) : Uri + private static function marshalUriFromSapi(array $server, array $headers): Uri { $uri = new Uri(''); // URI scheme - $https = false; + $https = false; if (array_key_exists('HTTPS', $server)) { $https = self::marshalHttpsValue($server['HTTPS']); } elseif (array_key_exists('https', $server)) { @@ -162,13 +175,21 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * @return array{string, int|null} Array of two items, host and port, * in that order (can be passed to a list() operation). */ - private static function marshalHostAndPort(array $server, array $headers) : array + private static function marshalHostAndPort(array $server, array $headers): array { static $defaults = ['', null]; $host = self::getHeaderFromArray('host', $headers, false); if ($host !== false) { - return self::marshalHostAndPortFromHeader($host); + // Ignore obviously malformed host headers: + // - Whitespace is invalid within a hostname and break the URI representation within HTTP. + // non-printable characters other than SPACE and TAB are already rejected by HeaderSecurity. + // - A comma indicates that multiple host headers have been sent which is not legal + // and might be used in an attack where a load balancer sees a different host header + // than Diactoros. + if (! preg_match('/[\\t ,]/', $host)) { + return self::marshalHostAndPortFromHeader($host); + } } if (! isset($server['SERVER_NAME'])) { @@ -178,7 +199,8 @@ class ServerRequestFactory implements ServerRequestFactoryInterface $host = (string) $server['SERVER_NAME']; $port = isset($server['SERVER_PORT']) ? (int) $server['SERVER_PORT'] : null; - if (! isset($server['SERVER_ADDR']) + if ( + ! isset($server['SERVER_ADDR']) || ! preg_match('/^\[[0-9a-fA-F\:]+\]$/', $host) ) { return [$host, $port]; @@ -193,7 +215,7 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * @return array{string, int|null} Array of two items, host and port, * in that order (can be passed to a list() operation). */ - private static function marshalIpv6HostAndPort(array $server, ?int $port) : array + private static function marshalIpv6HostAndPort(array $server, ?int $port): array { $host = '[' . (string) $server['SERVER_ADDR'] . ']'; $port = $port ?: 80; @@ -221,7 +243,7 @@ class ServerRequestFactory implements ServerRequestFactoryInterface * - REQUEST_URI * - ORIG_PATH_INFO */ - private static function marshalRequestPath(array $server) : string + private static function marshalRequestPath(array $server): string { // IIS7 with URL Rewrite: make sure we get the unencoded url // (double slash problem). @@ -248,7 +270,7 @@ class ServerRequestFactory implements ServerRequestFactoryInterface /** * @param mixed $https */ - private static function marshalHttpsValue($https) : bool + private static function marshalHttpsValue($https): bool { if (is_bool($https)) { return $https; @@ -289,9 +311,10 @@ class ServerRequestFactory implements ServerRequestFactoryInterface /** * Retrieve a header value from an array of headers using a case-insensitive lookup. * + * @template T * @param array> $headers Key/value header pairs - * @param mixed $default Default value to return if header not found - * @return mixed + * @param T $default Default value to return if header not found + * @return string|T */ private static function getHeaderFromArray(string $name, array $headers, $default = null) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/FilterUsingXForwardedHeaders.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/FilterUsingXForwardedHeaders.php index 00b9707b45..4ae9c17f07 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/FilterUsingXForwardedHeaders.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/FilterUsingXForwardedHeaders.php @@ -8,6 +8,17 @@ use Laminas\Diactoros\Exception\InvalidForwardedHeaderNameException; use Laminas\Diactoros\Exception\InvalidProxyAddressException; use Psr\Http\Message\ServerRequestInterface; +use function explode; +use function filter_var; +use function in_array; +use function is_string; +use function strpos; +use function strtolower; + +use const FILTER_FLAG_IPV4; +use const FILTER_FLAG_IPV6; +use const FILTER_VALIDATE_IP; + /** * Modify the URI to reflect the X-Forwarded-* headers. * @@ -30,9 +41,7 @@ final class FilterUsingXForwardedHeaders implements FilterServerRequestInterface self::HEADER_PROTO, ]; - /** - * @var list - */ + /** @var list */ private $trustedHeaders; /** @var list */ @@ -84,7 +93,7 @@ final class FilterUsingXForwardedHeaders implements FilterServerRequestInterface break; case self::HEADER_PROTO: $scheme = strtolower($header) === 'https' ? 'https' : 'http'; - $uri = $uri->withScheme($scheme); + $uri = $uri->withScheme($scheme); break; } } @@ -229,7 +238,7 @@ final class FilterUsingXForwardedHeaders implements FilterServerRequestInterface $mask = null; if (false !== strpos($cidr, '/')) { [$address, $mask] = explode('/', $cidr, 2); - $mask = (int) $mask; + $mask = (int) $mask; } if (false !== strpos($address, ':')) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/IPRange.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/IPRange.php index 871dde8421..a306ffd871 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/IPRange.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFilter/IPRange.php @@ -4,6 +4,18 @@ declare(strict_types=1); namespace Laminas\Diactoros\ServerRequestFilter; +use function explode; +use function inet_pton; +use function intval; +use function ip2long; +use function pack; +use function sprintf; +use function str_pad; +use function str_repeat; +use function strpos; +use function substr_compare; +use function unpack; + /** @internal */ final class IPRange { @@ -32,7 +44,7 @@ final class IPRange if (false !== strpos($cidr, '/')) { [$subnet, $mask] = explode('/', $cidr, 2); - $mask = (int) $mask; + $mask = (int) $mask; } if ($mask < 0 || $mask > 32) { @@ -62,7 +74,7 @@ final class IPRange if (false !== strpos($cidr, '/')) { [$subnet, $mask] = explode('/', $cidr, 2); - $mask = (int) $mask; + $mask = (int) $mask; } if ($mask < 0 || $mask > 128) { @@ -72,7 +84,7 @@ final class IPRange $ip = inet_pton($ip); $subnet = inet_pton($subnet); - if (false == $ip || false == $subnet) { + if (false === $ip || false === $subnet) { // Invalid data return false; } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Stream.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Stream.php index 063e96c79d..29c1931bd3 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Stream.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Stream.php @@ -4,8 +4,10 @@ declare(strict_types=1); namespace Laminas\Diactoros; +use GdImage; use Psr\Http\Message\StreamInterface; use RuntimeException; +use Throwable; use function array_key_exists; use function fclose; @@ -17,16 +19,16 @@ use function fstat; use function ftell; use function fwrite; use function get_resource_type; +use function in_array; use function is_int; use function is_resource; use function is_string; -use function restore_error_handler; -use function set_error_handler; +use function sprintf; use function stream_get_contents; use function stream_get_meta_data; use function strstr; -use const E_WARNING; +use const PHP_VERSION_ID; use const SEEK_SET; /** @@ -39,14 +41,10 @@ class Stream implements StreamInterface */ private const ALLOWED_STREAM_RESOURCE_TYPES = ['gd', 'stream']; - /** - * @var resource|null - */ + /** @var resource|null */ protected $resource; - /** - * @var string|resource - */ + /** @var string|resource */ protected $stream; /** @@ -62,7 +60,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function __toString() : string + public function __toString(): string { if (! $this->isReadable()) { return ''; @@ -82,7 +80,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function close() : void + public function close(): void { if (! $this->resource) { return; @@ -97,7 +95,7 @@ class Stream implements StreamInterface */ public function detach() { - $resource = $this->resource; + $resource = $this->resource; $this->resource = null; return $resource; } @@ -106,12 +104,10 @@ class Stream implements StreamInterface * Attach a new stream/resource to the instance. * * @param string|resource $resource - * @param string $mode - * @throws Exception\InvalidArgumentException for stream identifier that cannot be - * cast to a resource - * @throws Exception\InvalidArgumentException for non-resource stream + * @throws Exception\InvalidArgumentException For stream identifier that cannot be cast to a resource. + * @throws Exception\InvalidArgumentException For non-resource stream. */ - public function attach($resource, string $mode = 'r') : void + public function attach($resource, string $mode = 'r'): void { $this->setStream($resource, $mode); } @@ -119,7 +115,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function getSize() : ?int + public function getSize(): ?int { if (null === $this->resource) { return null; @@ -136,7 +132,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function tell() : int + public function tell(): int { if (! $this->resource) { throw Exception\UntellableStreamException::dueToMissingResource(); @@ -153,7 +149,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function eof() : bool + public function eof(): bool { if (! $this->resource) { return true; @@ -165,7 +161,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function isSeekable() : bool + public function isSeekable(): bool { if (! $this->resource) { return false; @@ -178,7 +174,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function seek($offset, $whence = SEEK_SET) : void + public function seek($offset, $whence = SEEK_SET): void { if (! $this->resource) { throw Exception\UnseekableStreamException::dueToMissingResource(); @@ -198,7 +194,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function rewind() : void + public function rewind(): void { $this->seek(0); } @@ -206,7 +202,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function isWritable() : bool + public function isWritable(): bool { if (! $this->resource) { return false; @@ -215,19 +211,17 @@ class Stream implements StreamInterface $meta = stream_get_meta_data($this->resource); $mode = $meta['mode']; - return ( - strstr($mode, 'x') + return strstr($mode, 'x') || strstr($mode, 'w') || strstr($mode, 'c') || strstr($mode, 'a') - || strstr($mode, '+') - ); + || strstr($mode, '+'); } /** * {@inheritdoc} */ - public function write($string) : int + public function write($string): int { if (! $this->resource) { throw Exception\UnwritableStreamException::dueToMissingResource(); @@ -249,7 +243,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function isReadable() : bool + public function isReadable(): bool { if (! $this->resource) { return false; @@ -258,13 +252,13 @@ class Stream implements StreamInterface $meta = stream_get_meta_data($this->resource); $mode = $meta['mode']; - return (strstr($mode, 'r') || strstr($mode, '+')); + return strstr($mode, 'r') || strstr($mode, '+'); } /** * {@inheritdoc} */ - public function read($length) : string + public function read($length): string { if (! $this->resource) { throw Exception\UnreadableStreamException::dueToMissingResource(); @@ -286,7 +280,7 @@ class Stream implements StreamInterface /** * {@inheritdoc} */ - public function getContents() : string + public function getContents(): string { if (! $this->isReadable()) { throw Exception\UnreadableStreamException::dueToConfiguration(); @@ -321,27 +315,22 @@ class Stream implements StreamInterface * * @param string|resource $stream String stream target or stream resource. * @param string $mode Resource mode for stream target. - * @throws Exception\InvalidArgumentException for invalid streams or resources. + * @throws Exception\InvalidArgumentException For invalid streams or resources. */ - private function setStream($stream, string $mode = 'r') : void + private function setStream($stream, string $mode = 'r'): void { - $error = null; $resource = $stream; if (is_string($stream)) { - set_error_handler(function ($e) use (&$error) { - if ($e !== E_WARNING) { - return; - } - - $error = $e; - }); - $resource = fopen($stream, $mode); - restore_error_handler(); - } - - if ($error) { - throw new Exception\RuntimeException('Invalid stream reference provided'); + try { + $resource = fopen($stream, $mode); + } catch (Throwable $error) { + throw new Exception\RuntimeException( + sprintf('Invalid stream reference provided: %s', $error->getMessage()), + 0, + $error + ); + } } if (! $this->isValidStreamResourceType($resource)) { @@ -360,7 +349,8 @@ class Stream implements StreamInterface /** * Determine if a resource is one of the resource types allowed to instantiate a Stream * - * @param resource $resource Stream resource. + * @param mixed $resource Stream resource. + * @psalm-assert-if-true resource $resource */ private function isValidStreamResourceType($resource): bool { @@ -368,7 +358,7 @@ class Stream implements StreamInterface return in_array(get_resource_type($resource), self::ALLOWED_STREAM_RESOURCE_TYPES, true); } - if (PHP_VERSION_ID >= 80000 && $resource instanceof \GdImage) { + if (PHP_VERSION_ID >= 80000 && $resource instanceof GdImage) { return true; } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php index 9105ff2e28..54596dbaee 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php @@ -9,8 +9,6 @@ use Psr\Http\Message\StreamInterface; use function fopen; use function fwrite; -use function get_resource_type; -use function is_resource; use function rewind; class StreamFactory implements StreamFactoryInterface @@ -18,7 +16,7 @@ class StreamFactory implements StreamFactoryInterface /** * {@inheritDoc} */ - public function createStream(string $content = '') : StreamInterface + public function createStream(string $content = ''): StreamInterface { $resource = fopen('php://temp', 'r+'); fwrite($resource, $content); @@ -30,7 +28,7 @@ class StreamFactory implements StreamFactoryInterface /** * {@inheritDoc} */ - public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface + public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface { return new Stream($file, $mode); } @@ -38,7 +36,7 @@ class StreamFactory implements StreamFactoryInterface /** * {@inheritDoc} */ - public function createStreamFromResource($resource) : StreamInterface + public function createStreamFromResource($resource): StreamInterface { return new Stream($resource); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php index 93980f307b..93e8bf27a9 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php @@ -9,16 +9,16 @@ use Psr\Http\Message\UploadedFileInterface; use function dirname; use function fclose; +use function file_exists; use function fopen; use function fwrite; use function is_dir; -use function is_int; use function is_resource; use function is_string; use function is_writable; use function move_uploaded_file; -use function sprintf; use function strpos; +use function unlink; use const PHP_SAPI; use const UPLOAD_ERR_CANT_WRITE; @@ -44,55 +44,37 @@ class UploadedFile implements UploadedFileInterface UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload.', ]; - /** - * @var string|null - */ + /** @var string|null */ private $clientFilename; - /** - * @var string|null - */ + /** @var string|null */ private $clientMediaType; - /** - * @var int - */ + /** @var int */ private $error; - /** - * @var null|string - */ + /** @var null|string */ private $file; - /** - * @var bool - */ + /** @var bool */ private $moved = false; - /** - * @var int - */ + /** @var int */ private $size; - /** - * @var null|StreamInterface - */ + /** @var null|StreamInterface */ private $stream; /** * @param string|resource|StreamInterface $streamOrFile - * @param int $size - * @param int $errorStatus - * @param string|null $clientFilename - * @param string|null $clientMediaType * @throws Exception\InvalidArgumentException */ public function __construct( $streamOrFile, int $size, int $errorStatus, - string $clientFilename = null, - string $clientMediaType = null + ?string $clientFilename = null, + ?string $clientMediaType = null ) { if ($errorStatus === UPLOAD_ERR_OK) { if (is_string($streamOrFile)) { @@ -119,16 +101,16 @@ class UploadedFile implements UploadedFileInterface } $this->error = $errorStatus; - $this->clientFilename = $clientFilename; + $this->clientFilename = $clientFilename; $this->clientMediaType = $clientMediaType; } /** * {@inheritdoc} - * @throws Exception\UploadedFileAlreadyMovedException if the upload was - * not successful. + * + * @throws Exception\UploadedFileAlreadyMovedException If the upload was not successful. */ - public function getStream() : StreamInterface + public function getStream(): StreamInterface { if ($this->error !== UPLOAD_ERR_OK) { throw Exception\UploadedFileErrorException::dueToStreamUploadError( @@ -153,13 +135,14 @@ class UploadedFile implements UploadedFileInterface * * @see http://php.net/is_uploaded_file * @see http://php.net/move_uploaded_file + * * @param string $targetPath Path to which to move the uploaded file. - * @throws Exception\UploadedFileErrorException if the upload was not successful. - * @throws Exception\InvalidArgumentException if the $path specified is invalid. - * @throws Exception\UploadedFileErrorException on any error during the + * @throws Exception\UploadedFileErrorException If the upload was not successful. + * @throws Exception\InvalidArgumentException If the $path specified is invalid. + * @throws Exception\UploadedFileErrorException On any error during the * move operation, or on the second or subsequent call to the method. */ - public function moveTo($targetPath) : void + public function moveTo($targetPath): void { if ($this->moved) { throw new Exception\UploadedFileAlreadyMovedException('Cannot move file; already moved!'); @@ -184,9 +167,16 @@ class UploadedFile implements UploadedFileInterface $sapi = PHP_SAPI; switch (true) { - case (empty($sapi) || 0 === strpos($sapi, 'cli') || 0 === strpos($sapi, 'phpdbg') || ! $this->file): + case empty($sapi) || 0 === strpos($sapi, 'cli') || 0 === strpos($sapi, 'phpdbg') || ! $this->file: // Non-SAPI environment, or no filename present $this->writeFile($targetPath); + + if ($this->stream instanceof StreamInterface) { + $this->stream->close(); + } + if (is_string($this->file) && file_exists($this->file)) { + unlink($this->file); + } break; default: // SAPI environment, with file present @@ -204,7 +194,7 @@ class UploadedFile implements UploadedFileInterface * * @return int|null The file size in bytes or null if unknown. */ - public function getSize() : ?int + public function getSize(): ?int { return $this->size; } @@ -213,9 +203,10 @@ class UploadedFile implements UploadedFileInterface * {@inheritdoc} * * @see http://php.net/manual/en/features.file-upload.errors.php + * * @return int One of PHP's UPLOAD_ERR_XXX constants. */ - public function getError() : int + public function getError(): int { return $this->error; } @@ -226,7 +217,7 @@ class UploadedFile implements UploadedFileInterface * @return string|null The filename sent by the client or null if none * was provided. */ - public function getClientFilename() : ?string + public function getClientFilename(): ?string { return $this->clientFilename; } @@ -234,17 +225,15 @@ class UploadedFile implements UploadedFileInterface /** * {@inheritdoc} */ - public function getClientMediaType() : ?string + public function getClientMediaType(): ?string { return $this->clientMediaType; } /** * Write internal stream to given path - * - * @param string $path */ - private function writeFile(string $path) : void + private function writeFile(string $path): void { $handle = fopen($path, 'wb+'); if (false === $handle) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php index 073c3ee384..1fa5fa348b 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php @@ -17,11 +17,11 @@ class UploadedFileFactory implements UploadedFileFactoryInterface */ public function createUploadedFile( StreamInterface $stream, - int $size = null, + ?int $size = null, int $error = UPLOAD_ERR_OK, - string $clientFilename = null, - string $clientMediaType = null - ) : UploadedFileInterface { + ?string $clientFilename = null, + ?string $clientMediaType = null + ): UploadedFileInterface { if ($size === null) { $size = $stream->getSize(); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php index cf173d957b..feb43309c6 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php @@ -11,6 +11,7 @@ use function explode; use function get_class; use function gettype; use function implode; +use function is_float; use function is_numeric; use function is_object; use function is_string; @@ -52,51 +53,36 @@ class Uri implements UriInterface */ public const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~\pL'; - /** - * @var int[] Array indexed by valid scheme names to their corresponding ports. - */ + /** @var int[] Array indexed by valid scheme names to their corresponding ports. */ protected $allowedSchemes = [ 'http' => 80, 'https' => 443, ]; - /** - * @var string - */ + /** @var string */ private $scheme = ''; - /** - * @var string - */ + /** @var string */ private $userInfo = ''; - /** - * @var string - */ + /** @var string */ private $host = ''; - /** - * @var int|null - */ + /** @var int|null */ private $port; - /** - * @var string - */ + /** @var string */ private $path = ''; - /** - * @var string - */ + /** @var string */ private $query = ''; - /** - * @var string - */ + /** @var string */ private $fragment = ''; /** * generated uri string cache + * * @var string|null */ private $uriString; @@ -124,7 +110,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function __toString() : string + public function __toString(): string { if (null !== $this->uriString) { return $this->uriString; @@ -144,7 +130,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getScheme() : string + public function getScheme(): string { return $this->scheme; } @@ -152,7 +138,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getAuthority() : string + public function getAuthority(): string { if ('' === $this->host) { return ''; @@ -177,7 +163,7 @@ class Uri implements UriInterface * * {@inheritdoc} */ - public function getUserInfo() : string + public function getUserInfo(): string { return $this->userInfo; } @@ -185,7 +171,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getHost() : string + public function getHost(): string { return $this->host; } @@ -193,7 +179,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getPort() : ?int + public function getPort(): ?int { return $this->isNonStandardPort($this->scheme, $this->host, $this->port) ? $this->port @@ -203,7 +189,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getPath() : string + public function getPath(): string { return $this->path; } @@ -211,7 +197,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getQuery() : string + public function getQuery(): string { return $this->query; } @@ -219,7 +205,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function getFragment() : string + public function getFragment(): string { return $this->fragment; } @@ -227,7 +213,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withScheme($scheme) : UriInterface + public function withScheme($scheme): UriInterface { if (! is_string($scheme)) { throw new Exception\InvalidArgumentException(sprintf( @@ -244,7 +230,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->scheme = $scheme; return $new; @@ -258,7 +244,7 @@ class Uri implements UriInterface * * {@inheritdoc} */ - public function withUserInfo($user, $password = null) : UriInterface + public function withUserInfo($user, $password = null): UriInterface { if (! is_string($user)) { throw new Exception\InvalidArgumentException(sprintf( @@ -285,7 +271,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->userInfo = $info; return $new; @@ -294,7 +280,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withHost($host) : UriInterface + public function withHost($host): UriInterface { if (! is_string($host)) { throw new Exception\InvalidArgumentException(sprintf( @@ -309,7 +295,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->host = strtolower($host); return $new; @@ -318,7 +304,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withPort($port) : UriInterface + public function withPort($port): UriInterface { if ($port !== null) { if (! is_numeric($port) || is_float($port)) { @@ -343,7 +329,7 @@ class Uri implements UriInterface )); } - $new = clone $this; + $new = clone $this; $new->port = $port; return $new; @@ -352,7 +338,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withPath($path) : UriInterface + public function withPath($path): UriInterface { if (! is_string($path)) { throw new Exception\InvalidArgumentException( @@ -379,7 +365,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->path = $path; return $new; @@ -388,7 +374,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withQuery($query) : UriInterface + public function withQuery($query): UriInterface { if (! is_string($query)) { throw new Exception\InvalidArgumentException( @@ -409,7 +395,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->query = $query; return $new; @@ -418,7 +404,7 @@ class Uri implements UriInterface /** * {@inheritdoc} */ - public function withFragment($fragment) : UriInterface + public function withFragment($fragment): UriInterface { if (! is_string($fragment)) { throw new Exception\InvalidArgumentException(sprintf( @@ -435,7 +421,7 @@ class Uri implements UriInterface return $this; } - $new = clone $this; + $new = clone $this; $new->fragment = $fragment; return $new; @@ -444,7 +430,7 @@ class Uri implements UriInterface /** * Parse a URI into its parts, and set the properties */ - private function parseUri(string $uri) : void + private function parseUri(string $uri): void { $parts = parse_url($uri); @@ -454,13 +440,13 @@ class Uri implements UriInterface ); } - $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; - $this->userInfo = isset($parts['user']) ? $this->filterUserInfoPart($parts['user']) : ''; - $this->host = isset($parts['host']) ? strtolower($parts['host']) : ''; - $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; - $this->query = isset($parts['query']) ? $this->filterQuery($parts['query']) : ''; - $this->fragment = isset($parts['fragment']) ? $this->filterFragment($parts['fragment']) : ''; + $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; + $this->userInfo = isset($parts['user']) ? $this->filterUserInfoPart($parts['user']) : ''; + $this->host = isset($parts['host']) ? strtolower($parts['host']) : ''; + $this->port = $parts['port'] ?? null; + $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; + $this->query = isset($parts['query']) ? $this->filterQuery($parts['query']) : ''; + $this->fragment = isset($parts['fragment']) ? $this->filterFragment($parts['fragment']) : ''; if (isset($parts['pass'])) { $this->userInfo .= ':' . $parts['pass']; @@ -476,7 +462,7 @@ class Uri implements UriInterface string $path, string $query, string $fragment - ) : string { + ): string { $uri = ''; if ('' !== $scheme) { @@ -493,7 +479,6 @@ class Uri implements UriInterface $uri .= $path; - if ('' !== $query) { $uri .= sprintf('?%s', $query); } @@ -508,7 +493,7 @@ class Uri implements UriInterface /** * Is a given port non-standard for the current scheme? */ - private function isNonStandardPort(string $scheme, string $host, ?int $port) : bool + private function isNonStandardPort(string $scheme, string $host, ?int $port): bool { if ('' === $scheme) { return '' === $host || null !== $port; @@ -527,7 +512,7 @@ class Uri implements UriInterface * @param string $scheme Scheme name. * @return string Filtered scheme. */ - private function filterScheme(string $scheme) : string + private function filterScheme(string $scheme): string { $scheme = strtolower($scheme); $scheme = preg_replace('#:(//)?$#', '', $scheme); @@ -549,11 +534,8 @@ class Uri implements UriInterface /** * Filters a part of user info in a URI to ensure it is properly encoded. - * - * @param string $part - * @return string */ - private function filterUserInfoPart(string $part) : string + private function filterUserInfoPart(string $part): string { $part = $this->filterInvalidUtf8($part); @@ -569,7 +551,7 @@ class Uri implements UriInterface /** * Filters the path of a URI to ensure it is properly encoded. */ - private function filterPath(string $path) : string + private function filterPath(string $path): string { $path = $this->filterInvalidUtf8($path); @@ -596,7 +578,7 @@ class Uri implements UriInterface /** * Encode invalid UTF-8 characters in given string. All other characters are unchanged. */ - private function filterInvalidUtf8(string $string) : string + private function filterInvalidUtf8(string $string): string { // check if given string contains only valid UTF-8 characters if (preg_match('//u', $string)) { @@ -618,7 +600,7 @@ class Uri implements UriInterface * * Ensures that the values in the query string are properly urlencoded. */ - private function filterQuery(string $query) : string + private function filterQuery(string $query): string { if ('' !== $query && strpos($query, '?') === 0) { $query = substr($query, 1); @@ -644,10 +626,9 @@ class Uri implements UriInterface /** * Split a query value into a key/value tuple. * - * @param string $value * @return array A value with exactly two elements, key and value */ - private function splitQueryValue(string $value) : array + private function splitQueryValue(string $value): array { $data = explode('=', $value, 2); if (! isset($data[1])) { @@ -659,7 +640,7 @@ class Uri implements UriInterface /** * Filter a fragment value to ensure it is properly encoded. */ - private function filterFragment(string $fragment) : string + private function filterFragment(string $fragment): string { if ('' !== $fragment && strpos($fragment, '#') === 0) { $fragment = '%23' . substr($fragment, 1); @@ -671,7 +652,7 @@ class Uri implements UriInterface /** * Filter a query string key or value, or a fragment. */ - private function filterQueryOrFragment(string $value) : string + private function filterQueryOrFragment(string $value): string { $value = $this->filterInvalidUtf8($value); @@ -685,7 +666,7 @@ class Uri implements UriInterface /** * URL encode a character returned by a regex. */ - private function urlEncodeChar(array $matches) : string + private function urlEncodeChar(array $matches): string { return rawurlencode($matches[0]); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php index ed53827b7c..f460e37d9d 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php @@ -12,7 +12,7 @@ class UriFactory implements UriFactoryInterface /** * {@inheritDoc} */ - public function createUri(string $uri = '') : UriInterface + public function createUri(string $uri = ''): UriInterface { return new Uri($uri); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php index 3ccd44582a..fff753ff53 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php @@ -4,12 +4,15 @@ declare(strict_types=1); namespace Zend\Diactoros; +use Laminas\Diactoros\UploadedFile; + +use function func_get_args; use function Laminas\Diactoros\createUploadedFile as laminas_createUploadedFile; /** * @deprecated Use Laminas\Diactoros\createUploadedFile instead */ -function createUploadedFile(array $spec) : UploadedFile +function createUploadedFile(array $spec): UploadedFile { return laminas_createUploadedFile(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.php index 9ec4c1c4b9..22c37e9e49 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.php @@ -4,16 +4,19 @@ declare(strict_types=1); namespace Laminas\Diactoros; +use function sprintf; + /** * Create an uploaded file instance from an array of values. * * @param array $spec A single $_FILES entry. - * @throws Exception\InvalidArgumentException if one or more of the tmp_name, + * @throws Exception\InvalidArgumentException If one or more of the tmp_name, * size, or error keys are missing from $spec. */ -function createUploadedFile(array $spec) : UploadedFile +function createUploadedFile(array $spec): UploadedFile { - if (! isset($spec['tmp_name']) + if ( + ! isset($spec['tmp_name']) || ! isset($spec['size']) || ! isset($spec['error']) ) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php index c1fd2f35b4..372ad292ec 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php @@ -4,12 +4,13 @@ declare(strict_types=1); namespace Zend\Diactoros; +use function func_get_args; use function Laminas\Diactoros\marshalHeadersFromSapi as laminas_marshalHeadersFromSapi; /** * @deprecated Use Laminas\Diactoros\marshalHeadersFromSapi instead */ -function marshalHeadersFromSapi(array $server) : array +function marshalHeadersFromSapi(array $server): array { return laminas_marshalHeadersFromSapi(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php index 2bca072bc7..a00e7c11d1 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php @@ -15,10 +15,10 @@ use function substr; * @param array $server Values obtained from the SAPI (generally `$_SERVER`). * @return array Header/value pairs */ -function marshalHeadersFromSapi(array $server) : array +function marshalHeadersFromSapi(array $server): array { $contentHeaderLookup = isset($server['LAMINAS_DIACTOROS_STRICT_CONTENT_HEADER_LOOKUP']) - ? static function (string $key) : bool { + ? static function (string $key): bool { static $contentHeaders = [ 'CONTENT_TYPE' => true, 'CONTENT_LENGTH' => true, @@ -53,13 +53,13 @@ function marshalHeadersFromSapi(array $server) : array } if (strpos($key, 'HTTP_') === 0) { - $name = strtr(strtolower(substr($key, 5)), '_', '-'); + $name = strtr(strtolower(substr($key, 5)), '_', '-'); $headers[$name] = $value; continue; } if ($contentHeaderLookup($key)) { - $name = strtr(strtolower($key), '_', '-'); + $name = strtr(strtolower($key), '_', '-'); $headers[$name] = $value; continue; } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php index 7db5e0e899..2eb83d97ab 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php @@ -4,12 +4,13 @@ declare(strict_types=1); namespace Zend\Diactoros; +use function func_get_args; use function Laminas\Diactoros\marshalMethodFromSapi as laminas_marshalMethodFromSapi; /** * @deprecated Use Laminas\Diactoros\marshalMethodFromSapi instead */ -function marshalMethodFromSapi(array $server) : string +function marshalMethodFromSapi(array $server): string { return laminas_marshalMethodFromSapi(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php index 03f286e89a..8feeb3169f 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php @@ -7,7 +7,7 @@ namespace Laminas\Diactoros; /** * Retrieve the request method from the SAPI parameters. */ -function marshalMethodFromSapi(array $server) : string +function marshalMethodFromSapi(array $server): string { return $server['REQUEST_METHOD'] ?? 'GET'; } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php index 9c262d57e7..2c69d6db60 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php @@ -4,12 +4,13 @@ declare(strict_types=1); namespace Zend\Diactoros; +use function func_get_args; use function Laminas\Diactoros\marshalProtocolVersionFromSapi as laminas_marshalProtocolVersionFromSapi; /** * @deprecated Use Laminas\Diactoros\marshalProtocolVersionFromSapi instead */ -function marshalProtocolVersionFromSapi(array $server) : string +function marshalProtocolVersionFromSapi(array $server): string { return laminas_marshalProtocolVersionFromSapi(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php index e64089dab1..a5eefee888 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php @@ -9,10 +9,10 @@ use function preg_match; /** * Return HTTP protocol version (X.Y) as discovered within a `$_SERVER` array. * - * @throws Exception\UnrecognizedProtocolVersionException if the + * @throws Exception\UnrecognizedProtocolVersionException If the * $server['SERVER_PROTOCOL'] value is malformed. */ -function marshalProtocolVersionFromSapi(array $server) : string +function marshalProtocolVersionFromSapi(array $server): string { if (! isset($server['SERVER_PROTOCOL'])) { return '1.1'; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php index f121f23fe4..43fff2a815 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php @@ -4,12 +4,15 @@ declare(strict_types=1); namespace Zend\Diactoros; +use Laminas\Diactoros\Uri; + +use function func_get_args; use function Laminas\Diactoros\marshalUriFromSapi as laminas_marshalUriFromSapi; /** * @deprecated Use Laminas\Diactoros\marshalUriFromSapi instead */ -function marshalUriFromSapi(array $server, array $headers) : Uri +function marshalUriFromSapi(array $server, array $headers): Uri { return laminas_marshalUriFromSapi(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php index 0092aeff7a..abdcfe8ab0 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php @@ -7,25 +7,33 @@ namespace Laminas\Diactoros; use function array_change_key_case; use function array_key_exists; use function explode; +use function gettype; use function implode; use function is_array; +use function is_bool; +use function is_string; use function ltrim; use function preg_match; use function preg_replace; +use function sprintf; use function strlen; use function strpos; +use function strrpos; use function strtolower; use function substr; +use const CASE_LOWER; + /** * Marshal a Uri instance based on the values presnt in the $_SERVER array and headers. * - * @param array $server SAPI parameters - * @param array $headers HTTP request headers * @deprecated This function is deprecated as of 2.11.1, and will be removed in * 3.0.0. As of 2.11.1, it is no longer used internally. + * + * @param array $server SAPI parameters + * @param array $headers HTTP request headers */ -function marshalUriFromSapi(array $server, array $headers) : Uri +function marshalUriFromSapi(array $server, array $headers): Uri { /** * Retrieve a header value from an array of headers using a case-insensitive lookup. @@ -38,8 +46,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri $header = strtolower($name); $headers = array_change_key_case($headers, CASE_LOWER); if (array_key_exists($header, $headers)) { - $value = is_array($headers[$header]) ? implode(', ', $headers[$header]) : $headers[$header]; - return $value; + return is_array($headers[$header]) ? implode(', ', $headers[$header]) : $headers[$header]; } return $default; @@ -51,7 +58,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri * @return array Array of two items, host and port, in that order (can be * passed to a list() operation). */ - $marshalHostAndPort = function (array $headers, array $server) use ($getHeaderFromArray) : array { + $marshalHostAndPort = function (array $headers, array $server) use ($getHeaderFromArray): array { /** * @param string|array $host * @return array Array of two items, host and port, in that order (can be @@ -77,7 +84,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri * @return array Array of two items, host and port, in that order (can be * passed to a list() operation). */ - $marshalIpv6HostAndPort = function (array $server, ?int $port) : array { + $marshalIpv6HostAndPort = function (array $server, ?int $port): array { $host = '[' . $server['SERVER_ADDR'] . ']'; $port = $port ?: 80; if ($port . ']' === substr($host, strrpos($host, ':') + 1)) { @@ -107,7 +114,8 @@ function marshalUriFromSapi(array $server, array $headers) : Uri $host = $server['SERVER_NAME']; $port = isset($server['SERVER_PORT']) ? (int) $server['SERVER_PORT'] : null; - if (! isset($server['SERVER_ADDR']) + if ( + ! isset($server['SERVER_ADDR']) || ! preg_match('/^\[[0-9a-fA-F\:]+\]$/', $host) ) { return [$host, $port]; @@ -130,7 +138,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri * * From Laminas\Http\PhpEnvironment\Request class */ - $marshalRequestPath = function (array $server) : string { + $marshalRequestPath = function (array $server): string { // IIS7 with URL Rewrite: make sure we get the unencoded url // (double slash problem). $iisUrlRewritten = $server['IIS_WasUrlRewritten'] ?? null; @@ -156,8 +164,8 @@ function marshalUriFromSapi(array $server, array $headers) : Uri $uri = new Uri(''); // URI scheme - $scheme = 'http'; - $marshalHttpsValue = function ($https) : bool { + $scheme = 'http'; + $marshalHttpsValue = function ($https): bool { if (is_bool($https)) { return $https; } @@ -179,7 +187,8 @@ function marshalUriFromSapi(array $server, array $headers) : Uri $https = false; } - if ($https + if ( + $https || strtolower($getHeaderFromArray('x-forwarded-proto', $headers, '')) === 'https' ) { $scheme = 'https'; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php index a4287f2009..b355c4d889 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php @@ -4,12 +4,13 @@ declare(strict_types=1); namespace Zend\Diactoros; +use function func_get_args; use function Laminas\Diactoros\normalizeServer as laminas_normalizeServer; /** * @deprecated Use Laminas\Diactoros\normalizeServer instead */ -function normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array +function normalizeServer(array $server, ?callable $apacheRequestHeaderCallback = null): array { return laminas_normalizeServer(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.php index b673d9d199..c9efb3881d 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.php @@ -18,7 +18,7 @@ use function is_callable; * `apache_request_headers` under the Apache mod_php. * @return array Either $server verbatim, or with an added HTTP_AUTHORIZATION header. */ -function normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array +function normalizeServer(array $server, ?callable $apacheRequestHeaderCallback = null): array { if (null === $apacheRequestHeaderCallback && is_callable('apache_request_headers')) { $apacheRequestHeaderCallback = 'apache_request_headers'; @@ -26,7 +26,8 @@ function normalizeServer(array $server, callable $apacheRequestHeaderCallback = // If the HTTP_AUTHORIZATION value is already set, or the callback is not // callable, we return verbatim - if (isset($server['HTTP_AUTHORIZATION']) + if ( + isset($server['HTTP_AUTHORIZATION']) || ! is_callable($apacheRequestHeaderCallback) ) { return $server; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php index 69d1244d61..b21323fa5c 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php @@ -4,14 +4,13 @@ declare(strict_types=1); namespace Zend\Diactoros; -use Psr\Http\Message\UploadedFileInterface; - +use function func_get_args; use function Laminas\Diactoros\normalizeUploadedFiles as laminas_normalizeUploadedFiles; /** * @deprecated Use Laminas\Diactoros\normalizeUploadedFiles instead */ -function normalizeUploadedFiles(array $files) : array +function normalizeUploadedFiles(array $files): array { return laminas_normalizeUploadedFiles(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php index 406ea23513..ef32ec2e18 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php @@ -7,6 +7,7 @@ namespace Laminas\Diactoros; use Psr\Http\Message\UploadedFileInterface; use function is_array; +use function sprintf; /** * Normalize uploaded files @@ -15,9 +16,9 @@ use function is_array; * arrays are normalized. * * @return UploadedFileInterface[] - * @throws Exception\InvalidArgumentException for unrecognized values + * @throws Exception\InvalidArgumentException For unrecognized values. */ -function normalizeUploadedFiles(array $files) : array +function normalizeUploadedFiles(array $files): array { /** * Traverse a nested tree of uploaded file specifications. @@ -33,9 +34,9 @@ function normalizeUploadedFiles(array $files) : array array $tmpNameTree, array $sizeTree, array $errorTree, - array $nameTree = null, - array $typeTree = null - ) use (&$recursiveNormalize) : array { + ?array $nameTree = null, + ?array $typeTree = null + ) use (&$recursiveNormalize): array { $normalized = []; foreach ($tmpNameTree as $key => $value) { if (is_array($value)) { @@ -51,10 +52,10 @@ function normalizeUploadedFiles(array $files) : array } $normalized[$key] = createUploadedFile([ 'tmp_name' => $tmpNameTree[$key], - 'size' => $sizeTree[$key], - 'error' => $errorTree[$key], - 'name' => $nameTree[$key] ?? null, - 'type' => $typeTree[$key] ?? null, + 'size' => $sizeTree[$key], + 'error' => $errorTree[$key], + 'name' => $nameTree[$key] ?? null, + 'type' => $typeTree[$key] ?? null, ]); } return $normalized; @@ -74,8 +75,9 @@ function normalizeUploadedFiles(array $files) : array * @param array $files * @return UploadedFile[] */ - $normalizeUploadedFileSpecification = function (array $files = []) use (&$recursiveNormalize) : array { - if (! isset($files['tmp_name']) || ! is_array($files['tmp_name']) + $normalizeUploadedFileSpecification = function (array $files = []) use (&$recursiveNormalize): array { + if ( + ! isset($files['tmp_name']) || ! is_array($files['tmp_name']) || ! isset($files['size']) || ! is_array($files['size']) || ! isset($files['error']) || ! is_array($files['error']) ) { diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php index 1297d36a3a..8c9a46a3f0 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php @@ -4,12 +4,16 @@ declare(strict_types=1); namespace Zend\Diactoros; +use function func_get_args; use function Laminas\Diactoros\parseCookieHeader as laminas_parseCookieHeader; /** - * @deprecated Use Laminas\Diactoros\parseCookieHeader instead + * @deprecated Use {@see \Laminas\Diactoros\parseCookieHeader} instead + * + * @param string $cookieHeader A string cookie header value. + * @return array key/value cookie pairs. */ -function parseCookieHeader($cookieHeader) : array +function parseCookieHeader($cookieHeader): array { return laminas_parseCookieHeader(...func_get_args()); } diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.php index 5e79c085d7..acb187fa67 100644 --- a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.php +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.php @@ -7,6 +7,8 @@ namespace Laminas\Diactoros; use function preg_match_all; use function urldecode; +use const PREG_SET_ORDER; + /** * Parse a cookie header according to RFC 6265. * @@ -14,9 +16,9 @@ use function urldecode; * overwriting. Thus, the server request should take the cookies from the request header instead. * * @param string $cookieHeader A string cookie header value. - * @return array key/value cookie pairs. + * @return array key/value cookie pairs. */ -function parseCookieHeader($cookieHeader) : array +function parseCookieHeader($cookieHeader): array { preg_match_all('( (?:^\\n?[ \t]*|;[ ]) -- 2.20.1