From 0cd7505a2556cc4efdaa6e03e2aca6ed65ea46b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 5 Aug 2021 10:33:04 +0200 Subject: [PATCH] Add laminas/laminas-diactoros to composer dependencies --- .../files/lib/system/api/composer.json | 3 +- .../files/lib/system/api/composer.lock | 161 +- .../system/api/composer/autoload_classmap.php | 50 + .../system/api/composer/autoload_files.php | 17 + .../lib/system/api/composer/autoload_psr4.php | 2 + .../system/api/composer/autoload_static.php | 80 + .../lib/system/api/composer/installed.json | 167 +- .../lib/system/api/composer/installed.php | 26 +- .../laminas/laminas-diactoros/CHANGELOG.md | 1822 +++++++++++++++++ .../laminas/laminas-diactoros/COPYRIGHT.md | 1 + .../api/laminas/laminas-diactoros/LICENSE.md | 26 + .../api/laminas/laminas-diactoros/README.md | 36 + .../laminas/laminas-diactoros/composer.json | 94 + .../src/AbstractSerializer.php | 150 ++ .../laminas-diactoros/src/CallbackStream.php | 183 ++ .../laminas-diactoros/src/ConfigProvider.php | 51 + .../Exception/DeserializationException.php | 52 + .../src/Exception/ExceptionInterface.php | 20 + .../Exception/InvalidArgumentException.php | 15 + .../InvalidStreamPointerPositionException.php | 25 + .../src/Exception/SerializationException.php | 26 + .../Exception/UnreadableStreamException.php | 36 + .../UnrecognizedProtocolVersionException.php | 23 + .../Exception/UnrewindableStreamException.php | 21 + .../Exception/UnseekableStreamException.php | 36 + .../Exception/UntellableStreamException.php | 31 + .../Exception/UnwritableStreamException.php | 36 + .../UploadedFileAlreadyMovedException.php | 25 + .../Exception/UploadedFileErrorException.php | 44 + .../laminas-diactoros/src/HeaderSecurity.php | 175 ++ .../laminas-diactoros/src/MessageTrait.php | 416 ++++ .../laminas/laminas-diactoros/src/Module.php | 21 + .../laminas-diactoros/src/PhpInputStream.php | 94 + .../laminas-diactoros/src/RelativeStream.php | 183 ++ .../laminas/laminas-diactoros/src/Request.php | 76 + .../src/Request/ArraySerializer.php | 83 + .../src/Request/Serializer.php | 142 ++ .../laminas-diactoros/src/RequestFactory.php | 25 + .../laminas-diactoros/src/RequestTrait.php | 320 +++ .../laminas-diactoros/src/Response.php | 200 ++ .../src/Response/ArraySerializer.php | 85 + .../src/Response/EmptyResponse.php | 43 + .../src/Response/HtmlResponse.php | 80 + .../src/Response/InjectContentTypeTrait.php | 36 + .../src/Response/JsonResponse.php | 184 ++ .../src/Response/RedirectResponse.php | 53 + .../src/Response/Serializer.php | 105 + .../src/Response/TextResponse.php | 80 + .../src/Response/XmlResponse.php | 82 + .../laminas-diactoros/src/ResponseFactory.php | 26 + .../laminas-diactoros/src/ServerRequest.php | 256 +++ .../src/ServerRequestFactory.php | 100 + .../laminas/laminas-diactoros/src/Stream.php | 378 ++++ .../laminas-diactoros/src/StreamFactory.php | 51 + .../laminas-diactoros/src/UploadedFile.php | 268 +++ .../src/UploadedFileFactory.php | 37 + .../api/laminas/laminas-diactoros/src/Uri.php | 698 +++++++ .../laminas-diactoros/src/UriFactory.php | 25 + .../functions/create_uploaded_file.legacy.php | 21 + .../src/functions/create_uploaded_file.php | 40 + .../marshal_headers_from_sapi.legacy.php | 21 + .../functions/marshal_headers_from_sapi.php | 62 + .../marshal_method_from_sapi.legacy.php | 21 + .../functions/marshal_method_from_sapi.php | 19 + ...shal_protocol_version_from_sapi.legacy.php | 21 + .../marshal_protocol_version_from_sapi.php | 34 + .../marshal_uri_from_sapi.legacy.php | 21 + .../src/functions/marshal_uri_from_sapi.php | 224 ++ .../src/functions/normalize_server.legacy.php | 21 + .../src/functions/normalize_server.php | 53 + .../normalize_uploaded_files.legacy.php | 23 + .../functions/normalize_uploaded_files.php | 130 ++ .../functions/parse_cookie_header.legacy.php | 21 + .../src/functions/parse_cookie_header.php | 44 + .../.github/FUNDING.yml | 1 + .../workflows/release-on-milestone-closed.yml | 71 + .../laminas-zendframework-bridge/CHANGELOG.md | 686 +++++++ .../laminas-zendframework-bridge/COPYRIGHT.md | 1 + .../laminas-zendframework-bridge/LICENSE.md | 26 + .../laminas-zendframework-bridge/README.md | 24 + .../composer.json | 58 + .../config/replacements.php | 372 ++++ .../src/Autoloader.php | 172 ++ .../src/ConfigPostProcessor.php | 434 ++++ .../src/Module.php | 54 + .../src/Replacements.php | 46 + .../src/RewriteRules.php | 79 + .../src/autoload.php | 9 + 88 files changed, 10386 insertions(+), 4 deletions(-) create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/CHANGELOG.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/COPYRIGHT.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/LICENSE.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/README.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidArgumentException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/SerializationException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/HeaderSecurity.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/MessageTrait.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Module.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestTrait.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/HtmlResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/JsonResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/Serializer.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Stream.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/create_uploaded_file.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/FUNDING.yml create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/workflows/release-on-milestone-closed.yml create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/CHANGELOG.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/COPYRIGHT.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/LICENSE.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/README.md create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/composer.json create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/config/replacements.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Autoloader.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Module.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Replacements.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/RewriteRules.php create mode 100644 wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/autoload.php diff --git a/wcfsetup/install/files/lib/system/api/composer.json b/wcfsetup/install/files/lib/system/api/composer.json index e2a653fe39..812400065a 100644 --- a/wcfsetup/install/files/lib/system/api/composer.json +++ b/wcfsetup/install/files/lib/system/api/composer.json @@ -17,6 +17,7 @@ "pear/net_idna2": "^0.2.0", "scssphp/scssphp": "^1.4", "guzzlehttp/guzzle": "^7.3.0", - "paragonie/constant_time_encoding": "^2.3" + "paragonie/constant_time_encoding": "^2.3", + "laminas/laminas-diactoros": "^2.4" } } diff --git a/wcfsetup/install/files/lib/system/api/composer.lock b/wcfsetup/install/files/lib/system/api/composer.lock index b61a90f598..02440899d6 100644 --- a/wcfsetup/install/files/lib/system/api/composer.lock +++ b/wcfsetup/install/files/lib/system/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "daad7b81e20fb213695b7775be98f7fc", + "content-hash": "b828e29250a7fa9ea0b3fca22bca6864", "packages": [ { "name": "chrisjean/php-ico", @@ -395,6 +395,165 @@ }, "time": "2021-06-30T20:03:07+00:00" }, + { + "name": "laminas/laminas-diactoros", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-diactoros.git", + "reference": "36ef09b73e884135d2059cc498c938e90821bb57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/36ef09b73e884135d2059cc498c938e90821bb57", + "reference": "36ef09b73e884135d2059cc498c938e90821bb57", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "replace": { + "zendframework/zend-diactoros": "^2.2.1" + }, + "require-dev": { + "ext-curl": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-libxml": "*", + "http-interop/http-factory-tests": "^0.5.0", + "laminas/laminas-coding-standard": "~1.0.0", + "php-http/psr7-integration-tests": "^1.0", + "phpunit/phpunit": "^7.5.18" + }, + "type": "library", + "extra": { + "laminas": { + "config-provider": "Laminas\\Diactoros\\ConfigProvider", + "module": "Laminas\\Diactoros" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php", + "src/functions/create_uploaded_file.legacy.php", + "src/functions/marshal_headers_from_sapi.legacy.php", + "src/functions/marshal_method_from_sapi.legacy.php", + "src/functions/marshal_protocol_version_from_sapi.legacy.php", + "src/functions/marshal_uri_from_sapi.legacy.php", + "src/functions/normalize_server.legacy.php", + "src/functions/normalize_uploaded_files.legacy.php", + "src/functions/parse_cookie_header.legacy.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "http", + "laminas", + "psr", + "psr-17", + "psr-7" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-diactoros/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-diactoros/issues", + "rss": "https://github.com/laminas/laminas-diactoros/releases.atom", + "source": "https://github.com/laminas/laminas-diactoros" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2020-09-03T14:29:41+00:00" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/6ede70583e101030bcace4dcddd648f760ddf642", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "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": "2020-09-14T14:23:00+00:00" + }, { "name": "paragonie/constant_time_encoding", "version": "v2.4.0", diff --git a/wcfsetup/install/files/lib/system/api/composer/autoload_classmap.php b/wcfsetup/install/files/lib/system/api/composer/autoload_classmap.php index cc14048cfe..d78fd466a8 100644 --- a/wcfsetup/install/files/lib/system/api/composer/autoload_classmap.php +++ b/wcfsetup/install/files/lib/system/api/composer/autoload_classmap.php @@ -321,6 +321,56 @@ return array( 'HTMLPurifier_VarParser_Flexible' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php', 'HTMLPurifier_VarParser_Native' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Native.php', 'HTMLPurifier_Zipper' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/Zipper.php', + 'Laminas\\Diactoros\\AbstractSerializer' => $vendorDir . '/laminas/laminas-diactoros/src/AbstractSerializer.php', + 'Laminas\\Diactoros\\CallbackStream' => $vendorDir . '/laminas/laminas-diactoros/src/CallbackStream.php', + 'Laminas\\Diactoros\\ConfigProvider' => $vendorDir . '/laminas/laminas-diactoros/src/ConfigProvider.php', + 'Laminas\\Diactoros\\Exception\\DeserializationException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/DeserializationException.php', + 'Laminas\\Diactoros\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php', + 'Laminas\\Diactoros\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/InvalidArgumentException.php', + 'Laminas\\Diactoros\\Exception\\InvalidStreamPointerPositionException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php', + 'Laminas\\Diactoros\\Exception\\SerializationException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/SerializationException.php', + 'Laminas\\Diactoros\\Exception\\UnreadableStreamException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnrecognizedProtocolVersionException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php', + 'Laminas\\Diactoros\\Exception\\UnrewindableStreamException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnseekableStreamException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UntellableStreamException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnwritableStreamException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UploadedFileAlreadyMovedException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php', + 'Laminas\\Diactoros\\Exception\\UploadedFileErrorException' => $vendorDir . '/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php', + 'Laminas\\Diactoros\\HeaderSecurity' => $vendorDir . '/laminas/laminas-diactoros/src/HeaderSecurity.php', + 'Laminas\\Diactoros\\MessageTrait' => $vendorDir . '/laminas/laminas-diactoros/src/MessageTrait.php', + 'Laminas\\Diactoros\\Module' => $vendorDir . '/laminas/laminas-diactoros/src/Module.php', + 'Laminas\\Diactoros\\PhpInputStream' => $vendorDir . '/laminas/laminas-diactoros/src/PhpInputStream.php', + 'Laminas\\Diactoros\\RelativeStream' => $vendorDir . '/laminas/laminas-diactoros/src/RelativeStream.php', + 'Laminas\\Diactoros\\Request' => $vendorDir . '/laminas/laminas-diactoros/src/Request.php', + 'Laminas\\Diactoros\\RequestFactory' => $vendorDir . '/laminas/laminas-diactoros/src/RequestFactory.php', + 'Laminas\\Diactoros\\RequestTrait' => $vendorDir . '/laminas/laminas-diactoros/src/RequestTrait.php', + 'Laminas\\Diactoros\\Request\\ArraySerializer' => $vendorDir . '/laminas/laminas-diactoros/src/Request/ArraySerializer.php', + 'Laminas\\Diactoros\\Request\\Serializer' => $vendorDir . '/laminas/laminas-diactoros/src/Request/Serializer.php', + 'Laminas\\Diactoros\\Response' => $vendorDir . '/laminas/laminas-diactoros/src/Response.php', + 'Laminas\\Diactoros\\ResponseFactory' => $vendorDir . '/laminas/laminas-diactoros/src/ResponseFactory.php', + 'Laminas\\Diactoros\\Response\\ArraySerializer' => $vendorDir . '/laminas/laminas-diactoros/src/Response/ArraySerializer.php', + 'Laminas\\Diactoros\\Response\\EmptyResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/EmptyResponse.php', + 'Laminas\\Diactoros\\Response\\HtmlResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/HtmlResponse.php', + 'Laminas\\Diactoros\\Response\\InjectContentTypeTrait' => $vendorDir . '/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php', + 'Laminas\\Diactoros\\Response\\JsonResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/JsonResponse.php', + 'Laminas\\Diactoros\\Response\\RedirectResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/RedirectResponse.php', + 'Laminas\\Diactoros\\Response\\Serializer' => $vendorDir . '/laminas/laminas-diactoros/src/Response/Serializer.php', + 'Laminas\\Diactoros\\Response\\TextResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/TextResponse.php', + 'Laminas\\Diactoros\\Response\\XmlResponse' => $vendorDir . '/laminas/laminas-diactoros/src/Response/XmlResponse.php', + 'Laminas\\Diactoros\\ServerRequest' => $vendorDir . '/laminas/laminas-diactoros/src/ServerRequest.php', + 'Laminas\\Diactoros\\ServerRequestFactory' => $vendorDir . '/laminas/laminas-diactoros/src/ServerRequestFactory.php', + 'Laminas\\Diactoros\\Stream' => $vendorDir . '/laminas/laminas-diactoros/src/Stream.php', + 'Laminas\\Diactoros\\StreamFactory' => $vendorDir . '/laminas/laminas-diactoros/src/StreamFactory.php', + 'Laminas\\Diactoros\\UploadedFile' => $vendorDir . '/laminas/laminas-diactoros/src/UploadedFile.php', + 'Laminas\\Diactoros\\UploadedFileFactory' => $vendorDir . '/laminas/laminas-diactoros/src/UploadedFileFactory.php', + 'Laminas\\Diactoros\\Uri' => $vendorDir . '/laminas/laminas-diactoros/src/Uri.php', + 'Laminas\\Diactoros\\UriFactory' => $vendorDir . '/laminas/laminas-diactoros/src/UriFactory.php', + 'Laminas\\ZendFrameworkBridge\\Autoloader' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Autoloader.php', + 'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php', + 'Laminas\\ZendFrameworkBridge\\Module' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Module.php', + 'Laminas\\ZendFrameworkBridge\\Replacements' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Replacements.php', + 'Laminas\\ZendFrameworkBridge\\RewriteRules' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php', 'Net_IDNA2' => $vendorDir . '/pear/net_idna2/Net/IDNA2.php', 'Net_IDNA2_Exception' => $vendorDir . '/pear/net_idna2/Net/IDNA2/Exception.php', 'Net_IDNA2_Exception_Nameprep' => $vendorDir . '/pear/net_idna2/Net/IDNA2/Exception/Nameprep.php', diff --git a/wcfsetup/install/files/lib/system/api/composer/autoload_files.php b/wcfsetup/install/files/lib/system/api/composer/autoload_files.php index d5ea70c751..b3b9342a53 100644 --- a/wcfsetup/install/files/lib/system/api/composer/autoload_files.php +++ b/wcfsetup/install/files/lib/system/api/composer/autoload_files.php @@ -9,6 +9,23 @@ return array( '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '7e9bd612cc444b3eed788ebbe46263a0' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/autoload.php', '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + '07d7f1a47144818725fd8d91a907ac57' => $vendorDir . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php', + 'da94ac5d3ca7d2dbab84ce561ce72bfd' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php', + '3d97c8dcdfba8cb85d3b34f116bb248b' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php', + 'e6f3bc6883e449ab367280b34158c05b' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'd59fbae42019aedf227094ac49a46f50' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php', + 'de95e0ac670b27c84ef8c5ac41fc1b34' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_server.php', + 'b6c2870932b0250c10334a86dcb33c7f' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php', + 'd02cf21124526632320d6f20b1bbf905' => $vendorDir . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.php', + 'd919fc9d5ad52cfb7f322f7fe36458ab' => $vendorDir . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php', + 'e397f74f8af3b1e56166a6e99f216ee7' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php', + 'd154b49fab8e4da34fb553a2d644918c' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php', + '9d3db23ca418094bcf0b641a0c9559ed' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php', + 'b0b88a3b89caae681462c58ff19a7059' => $vendorDir . '/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php', + 'cc8e14526dc240491e17a838cb78508c' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php', + '786bf90caabc9e09b6ad4cc5ca8f0e30' => $vendorDir . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php', + '751a5a3f463e4be759be31748b61737c' => $vendorDir . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php', ); diff --git a/wcfsetup/install/files/lib/system/api/composer/autoload_psr4.php b/wcfsetup/install/files/lib/system/api/composer/autoload_psr4.php index 11508eb165..2262fd9d6d 100644 --- a/wcfsetup/install/files/lib/system/api/composer/autoload_psr4.php +++ b/wcfsetup/install/files/lib/system/api/composer/autoload_psr4.php @@ -14,6 +14,8 @@ return array( 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Pelago\\Emogrifier\\' => array($vendorDir . '/pelago/emogrifier/src'), 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), + 'Laminas\\ZendFrameworkBridge\\' => array($vendorDir . '/laminas/laminas-zendframework-bridge/src'), + 'Laminas\\Diactoros\\' => array($vendorDir . '/laminas/laminas-diactoros/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/wcfsetup/install/files/lib/system/api/composer/autoload_static.php b/wcfsetup/install/files/lib/system/api/composer/autoload_static.php index 6cd32a5d52..38c0399af3 100644 --- a/wcfsetup/install/files/lib/system/api/composer/autoload_static.php +++ b/wcfsetup/install/files/lib/system/api/composer/autoload_static.php @@ -10,8 +10,25 @@ class ComposerStaticInita1f5f7c74275d47a45049a2936db1d0d '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '7e9bd612cc444b3eed788ebbe46263a0' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/autoload.php', '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + '07d7f1a47144818725fd8d91a907ac57' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.php', + 'da94ac5d3ca7d2dbab84ce561ce72bfd' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.php', + '3d97c8dcdfba8cb85d3b34f116bb248b' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.php', + 'e6f3bc6883e449ab367280b34158c05b' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'd59fbae42019aedf227094ac49a46f50' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.php', + 'de95e0ac670b27c84ef8c5ac41fc1b34' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_server.php', + 'b6c2870932b0250c10334a86dcb33c7f' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.php', + 'd02cf21124526632320d6f20b1bbf905' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.php', + 'd919fc9d5ad52cfb7f322f7fe36458ab' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/create_uploaded_file.legacy.php', + 'e397f74f8af3b1e56166a6e99f216ee7' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_headers_from_sapi.legacy.php', + 'd154b49fab8e4da34fb553a2d644918c' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php', + '9d3db23ca418094bcf0b641a0c9559ed' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_protocol_version_from_sapi.legacy.php', + 'b0b88a3b89caae681462c58ff19a7059' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php', + 'cc8e14526dc240491e17a838cb78508c' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php', + '786bf90caabc9e09b6ad4cc5ca8f0e30' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/normalize_uploaded_files.legacy.php', + '751a5a3f463e4be759be31748b61737c' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php', ); public static $prefixLengthsPsr4 = array ( @@ -32,6 +49,11 @@ class ComposerStaticInita1f5f7c74275d47a45049a2936db1d0d 'Pelago\\Emogrifier\\' => 18, 'ParagonIE\\ConstantTime\\' => 23, ), + 'L' => + array ( + 'Laminas\\ZendFrameworkBridge\\' => 28, + 'Laminas\\Diactoros\\' => 18, + ), 'G' => array ( 'GuzzleHttp\\Psr7\\' => 16, @@ -74,6 +96,14 @@ class ComposerStaticInita1f5f7c74275d47a45049a2936db1d0d array ( 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', ), + 'Laminas\\ZendFrameworkBridge\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src', + ), + 'Laminas\\Diactoros\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-diactoros/src', + ), 'GuzzleHttp\\Psr7\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', @@ -428,6 +458,56 @@ class ComposerStaticInita1f5f7c74275d47a45049a2936db1d0d 'HTMLPurifier_VarParser_Flexible' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php', 'HTMLPurifier_VarParser_Native' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Native.php', 'HTMLPurifier_Zipper' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/Zipper.php', + 'Laminas\\Diactoros\\AbstractSerializer' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/AbstractSerializer.php', + 'Laminas\\Diactoros\\CallbackStream' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/CallbackStream.php', + 'Laminas\\Diactoros\\ConfigProvider' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/ConfigProvider.php', + 'Laminas\\Diactoros\\Exception\\DeserializationException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/DeserializationException.php', + 'Laminas\\Diactoros\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php', + 'Laminas\\Diactoros\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/InvalidArgumentException.php', + 'Laminas\\Diactoros\\Exception\\InvalidStreamPointerPositionException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/InvalidStreamPointerPositionException.php', + 'Laminas\\Diactoros\\Exception\\SerializationException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/SerializationException.php', + 'Laminas\\Diactoros\\Exception\\UnreadableStreamException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UnreadableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnrecognizedProtocolVersionException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UnrecognizedProtocolVersionException.php', + 'Laminas\\Diactoros\\Exception\\UnrewindableStreamException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UnrewindableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnseekableStreamException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UnseekableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UntellableStreamException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UntellableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UnwritableStreamException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UnwritableStreamException.php', + 'Laminas\\Diactoros\\Exception\\UploadedFileAlreadyMovedException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UploadedFileAlreadyMovedException.php', + 'Laminas\\Diactoros\\Exception\\UploadedFileErrorException' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Exception/UploadedFileErrorException.php', + 'Laminas\\Diactoros\\HeaderSecurity' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/HeaderSecurity.php', + 'Laminas\\Diactoros\\MessageTrait' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/MessageTrait.php', + 'Laminas\\Diactoros\\Module' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Module.php', + 'Laminas\\Diactoros\\PhpInputStream' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/PhpInputStream.php', + 'Laminas\\Diactoros\\RelativeStream' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/RelativeStream.php', + 'Laminas\\Diactoros\\Request' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Request.php', + 'Laminas\\Diactoros\\RequestFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/RequestFactory.php', + 'Laminas\\Diactoros\\RequestTrait' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/RequestTrait.php', + 'Laminas\\Diactoros\\Request\\ArraySerializer' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Request/ArraySerializer.php', + 'Laminas\\Diactoros\\Request\\Serializer' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Request/Serializer.php', + 'Laminas\\Diactoros\\Response' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response.php', + 'Laminas\\Diactoros\\ResponseFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/ResponseFactory.php', + 'Laminas\\Diactoros\\Response\\ArraySerializer' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/ArraySerializer.php', + 'Laminas\\Diactoros\\Response\\EmptyResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/EmptyResponse.php', + 'Laminas\\Diactoros\\Response\\HtmlResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/HtmlResponse.php', + 'Laminas\\Diactoros\\Response\\InjectContentTypeTrait' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php', + 'Laminas\\Diactoros\\Response\\JsonResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/JsonResponse.php', + 'Laminas\\Diactoros\\Response\\RedirectResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/RedirectResponse.php', + 'Laminas\\Diactoros\\Response\\Serializer' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/Serializer.php', + 'Laminas\\Diactoros\\Response\\TextResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/TextResponse.php', + 'Laminas\\Diactoros\\Response\\XmlResponse' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Response/XmlResponse.php', + 'Laminas\\Diactoros\\ServerRequest' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/ServerRequest.php', + 'Laminas\\Diactoros\\ServerRequestFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/ServerRequestFactory.php', + 'Laminas\\Diactoros\\Stream' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Stream.php', + 'Laminas\\Diactoros\\StreamFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/StreamFactory.php', + 'Laminas\\Diactoros\\UploadedFile' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/UploadedFile.php', + 'Laminas\\Diactoros\\UploadedFileFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/UploadedFileFactory.php', + 'Laminas\\Diactoros\\Uri' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/Uri.php', + 'Laminas\\Diactoros\\UriFactory' => __DIR__ . '/..' . '/laminas/laminas-diactoros/src/UriFactory.php', + 'Laminas\\ZendFrameworkBridge\\Autoloader' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Autoloader.php', + 'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php', + 'Laminas\\ZendFrameworkBridge\\Module' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Module.php', + 'Laminas\\ZendFrameworkBridge\\Replacements' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Replacements.php', + 'Laminas\\ZendFrameworkBridge\\RewriteRules' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php', 'Net_IDNA2' => __DIR__ . '/..' . '/pear/net_idna2/Net/IDNA2.php', 'Net_IDNA2_Exception' => __DIR__ . '/..' . '/pear/net_idna2/Net/IDNA2/Exception.php', 'Net_IDNA2_Exception_Nameprep' => __DIR__ . '/..' . '/pear/net_idna2/Net/IDNA2/Exception/Nameprep.php', diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.json b/wcfsetup/install/files/lib/system/api/composer/installed.json index 008b21b17e..a168227410 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.json +++ b/wcfsetup/install/files/lib/system/api/composer/installed.json @@ -395,6 +395,171 @@ }, "install-path": "../guzzlehttp/psr7" }, + { + "name": "laminas/laminas-diactoros", + "version": "2.4.1", + "version_normalized": "2.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-diactoros.git", + "reference": "36ef09b73e884135d2059cc498c938e90821bb57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/36ef09b73e884135d2059cc498c938e90821bb57", + "reference": "36ef09b73e884135d2059cc498c938e90821bb57", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "replace": { + "zendframework/zend-diactoros": "^2.2.1" + }, + "require-dev": { + "ext-curl": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-libxml": "*", + "http-interop/http-factory-tests": "^0.5.0", + "laminas/laminas-coding-standard": "~1.0.0", + "php-http/psr7-integration-tests": "^1.0", + "phpunit/phpunit": "^7.5.18" + }, + "time": "2020-09-03T14:29:41+00:00", + "type": "library", + "extra": { + "laminas": { + "config-provider": "Laminas\\Diactoros\\ConfigProvider", + "module": "Laminas\\Diactoros" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php", + "src/functions/create_uploaded_file.legacy.php", + "src/functions/marshal_headers_from_sapi.legacy.php", + "src/functions/marshal_method_from_sapi.legacy.php", + "src/functions/marshal_protocol_version_from_sapi.legacy.php", + "src/functions/marshal_uri_from_sapi.legacy.php", + "src/functions/normalize_server.legacy.php", + "src/functions/normalize_uploaded_files.legacy.php", + "src/functions/parse_cookie_header.legacy.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "http", + "laminas", + "psr", + "psr-17", + "psr-7" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-diactoros/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-diactoros/issues", + "rss": "https://github.com/laminas/laminas-diactoros/releases.atom", + "source": "https://github.com/laminas/laminas-diactoros" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "install-path": "../laminas/laminas-diactoros" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/6ede70583e101030bcace4dcddd648f760ddf642", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2020-09-14T14:23:00+00:00", + "type": "library", + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "installation-source": "dist", + "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" + } + ], + "install-path": "../laminas/laminas-zendframework-bridge" + }, { "name": "paragonie/constant_time_encoding", "version": "v2.4.0", @@ -1142,6 +1307,6 @@ "install-path": "../true/punycode" } ], - "dev": false, + "dev": true, "dev-package-names": [] } diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.php b/wcfsetup/install/files/lib/system/api/composer/installed.php index c3a27eed95..53a59d97db 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.php +++ b/wcfsetup/install/files/lib/system/api/composer/installed.php @@ -7,7 +7,7 @@ 'aliases' => array(), 'reference' => NULL, 'name' => '__root__', - 'dev' => false, + 'dev' => true, ), 'versions' => array( '__root__' => array( @@ -73,6 +73,24 @@ 'reference' => '1dc8d9cba3897165e16d12bb13d813afb1eb3fe7', 'dev_requirement' => false, ), + 'laminas/laminas-diactoros' => array( + 'pretty_version' => '2.4.1', + 'version' => '2.4.1.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../laminas/laminas-diactoros', + 'aliases' => array(), + 'reference' => '36ef09b73e884135d2059cc498c938e90821bb57', + 'dev_requirement' => false, + ), + 'laminas/laminas-zendframework-bridge' => array( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../laminas/laminas-zendframework-bridge', + 'aliases' => array(), + 'reference' => '6ede70583e101030bcace4dcddd648f760ddf642', + 'dev_requirement' => false, + ), 'paragonie/constant_time_encoding' => array( 'pretty_version' => 'v2.4.0', 'version' => '2.4.0.0', @@ -199,5 +217,11 @@ 'reference' => 'a4d0c11a36dd7f4e7cd7096076cab6d3378a071e', 'dev_requirement' => false, ), + 'zendframework/zend-diactoros' => array( + 'dev_requirement' => false, + 'replaced' => array( + 0 => '^2.2.1', + ), + ), ), ); diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/CHANGELOG.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/CHANGELOG.md new file mode 100644 index 0000000000..35723c3215 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/CHANGELOG.md @@ -0,0 +1,1822 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 2.4.1 - 2020-09-03 + + + +----- + +### Release Notes for [2.4.1](https://github.com/laminas/laminas-diactoros/milestone/6) + +2.4.x bugfix release (patch) + +### 2.4.1 + +- Total issues resolved: **0** +- Total pull requests resolved: **1** +- Total contributors: **1** + +#### Bug + + - [50: gd is used by test suite](https://github.com/laminas/laminas-diactoros/pull/50) thanks to @remicollet +## 2.4.0 - 2020-09-02 + +----- + +### Release Notes for [2.4.0](https://github.com/laminas/laminas-diactoros/milestone/1) + +Feature release (minor) + +### 2.4.0 + +- Total issues resolved: **0** +- Total pull requests resolved: **2** +- Total contributors: **2** + + + + + - [49: Merge release 2.3.2 into 2.4.x](https://github.com/laminas/laminas-diactoros/pull/49) thanks to @github-actions[bot] + +#### Enhancement + + - [45: Allow Streams to be instantiated using GD resources](https://github.com/laminas/laminas-diactoros/pull/45) thanks to @settermjd +## 2.3.2 - 2020-09-02 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#47](https://github.com/laminas/laminas-diactoros/pull/47) corrects the documented exception type thrown by `Laminas\Diactoros\Response\ArraySerializer::fromArray()` to indicate `Laminas\Diactoros\Exception\DeserializationException` is thrown by the method. + +----- + +### Release Notes for [2.3.2](https://github.com/laminas/laminas-diactoros/milestone/2) + +### 2.3.2 + +- Total issues resolved: **0** +- Total pull requests resolved: **1** +- Total contributors: **1** + +#### Bug,Documentation + + - [47: Fixes docblock @throws in ArraySerializer::getValueFromKey()](https://github.com/laminas/laminas-diactoros/pull/47) thanks to @samsonasik + +## 2.3.1 - 2020-07-07 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#44](https://github.com/laminas/laminas-diactoros/pull/44) fixes an issue whereby the uploaded file size was being provided as an integer string, and causing type errors. The value is now cast to integer before creating an `UploadedFile` instance. + +## 2.3.0 - 2020-04-27 + +### Added + +- [#37](https://github.com/laminas/laminas-diactoros/pull/37) adds a ConfigProvider and Module, allowing the package to be autoregistered within Mezzio and MVC applications. Each provides configuration mapping PSR-17 HTTP message factory interfaces to the Diactoros implementations of them. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.2.3 - 2020-03-29 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Fixed `replace` version constraint in composer.json so repository can be used as replacement of `zendframework/zend-diactoros:^2.2.1`. + +## 2.2.2 - 2020-01-07 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#30](https://github.com/laminas/laminas-diactoros/pull/30) adds missing `return` statements to the various `src/functions/*.legacy.php` function files to ensure they work correctly when used. + +## 2.2.1 - 2019-11-13 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#379](https://github.com/zendframework/zend-diactoros/pull/379) removes extension of `SplFileInfo` by the `UploadedFile` class. The signatures of `getSize()` are potentially incompatible, and `UploadedFile` is intended to work with arbitrary PHP and PSR-7 streams, whereas `SplFileInfo` can only model files on the filesystem. While this is technically a BC break, we are treating it as a bugfix, as the class was broken for many use cases. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.2.0 - 2019-11-12 + +### Added + +- [zendframework/zend-diactoros#376](https://github.com/zendframework/zend-diactoros/pull/376) adds support for using the X-Forwarded-Host header for determining the originally requested host name when marshaling the server request. + +### Changed + +- [zendframework/zend-diactoros#378](https://github.com/zendframework/zend-diactoros/pull/378) updates the `UploadedFile` class to extend `SplFileInfo`, allowing developers to make use of those features in their applications. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.2.0 - 2019-11-08 + +### Added + +- [zendframework/zend-diactoros#377](https://github.com/zendframework/zend-diactoros/issues/377) enables UploadedFile to stand in and be used as an SplFileInfo object. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.1.5 - 2019-10-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#372](https://github.com/zendframework/zend-diactoros/pull/372) fixes issues that occur in the `Laminas\Diactoros\Uri` class when invalid UTF-8 characters are present the user-info, path, or query string, ensuring they are URL-encoded before being consumed. Previously, such characters could result in a fatal error, which was particularly problematic when marshaling the request URI for an application request cycle. + +## 2.1.4 - 2019-10-08 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#370](https://github.com/zendframework/zend-diactoros/pull/370) updates `Laminas\Diactoros\marshalHeadersFromSapi()` to ensure all underscores in header name keys are converted to dashes (fixing issues with header names such as `CONTENT_SECURITY_POLICY`, which would previously resolve improperly to `content-security_policy`). + +- [zendframework/zend-diactoros#370](https://github.com/zendframework/zend-diactoros/pull/370) updates `Laminas\Diactoros\marshalHeadersFromSapi()` to ignore header names from the `$server` array that resolve to integers; previously, it would raise a fatal error. + +## 2.1.3 - 2019-07-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#363](https://github.com/zendframework/zend-diactoros/issues/363) modifies detection of HTTPS schemas via the `$_SERVER['HTTPS']` value + such that an empty HTTPS-key will result in a scheme of `http` and not + `https`. + +## 2.1.2 - 2019-04-29 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#355](https://github.com/zendframework/zend-diactoros/pull/355) adds `phpdbg` to the list of accepted non-SAPI enviornments for purposes + of calling `UploadedFile::moveTo()`. + +## 2.1.1 - 2019-01-05 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#349](https://github.com/zendframework/zend-diactoros/pull/349) fixes an issue when marshaling headers with values of `0` or `0` from the SAPI, ensuring they are detected and injected into the ServerRequest properly. + +## 2.1.0 - 2018-12-20 + +### Added + +- [zendframework/zend-diactoros#345](https://github.com/zendframework/zend-diactoros/pull/345) adds support for PHP 7.3. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.0.3 - 2019-01-05 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#349](https://github.com/zendframework/zend-diactoros/pull/349) fixes an issue when marshaling headers with values of `0` or `0` from the + SAPI, ensuring they are detected and injected into the ServerRequest properly. + +## 2.0.2 - 2018-12-20 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#344](https://github.com/zendframework/zend-diactoros/pull/344) provides a fix to ensure that headers with a value of "0" are retained. + +## 2.0.1 - 2018-12-03 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#337](https://github.com/zendframework/zend-diactoros/pull/337) ensures that the `ServerRequestFactory::createServerRequest()` method + creates a `php://temp` stream instead of a `php::input` stream, in compliance + with the PSR-17 specification. + +## 2.0.0 - 2018-09-27 + +### Added + +- [zendframework/zend-diactoros#326](https://github.com/zendframework/zend-diactoros/pull/326) adds [PSR-17](https://www.php-fig.org/psr/psr-17/) HTTP Message Factory implementations, including: + + - `Laminas\Diactoros\RequestFactory` + - `Laminas\Diactoros\ResponseFactory` + - `Laminas\Diactoros\ServerRequestFactory` + - `Laminas\Diactoros\StreamFactory` + - `Laminas\Diactoros\UploadedFileFactory` + - `Laminas\Diactoros\UriFactory` + + These factories may be used to produce the associated instances; we encourage + users to rely on the PSR-17 factory interfaces to allow exchanging PSR-7 + implementations within their applications. + +- [zendframework/zend-diactoros#328](https://github.com/zendframework/zend-diactoros/pull/328) adds a package-level exception interface, `Laminas\Diactoros\Exception\ExceptionInterface`, + and several implementations for specific exceptions raised within the package. + These include: + + - `Laminas\Diactoros\Exception\DeserializationException` (extends `UnexpectedValueException`) + - `Laminas\Diactoros\Exception\InvalidArgumentException` (extends `InvalidArgumentException`) + - `Laminas\Diactoros\Exception\InvalidStreamPointerPositionException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\SerializationException` (extends `UnexpectedValueException`) + - `Laminas\Diactoros\Exception\UnreadableStreamException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UnrecognizedProtocolVersionException` (extends `UnexpectedValueException`) + - `Laminas\Diactoros\Exception\UnrewindableStreamException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UnseekableStreamException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UntellableStreamException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UnwritableStreamException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UploadedFileAlreadyMovedException` (extends `RuntimeException`) + - `Laminas\Diactoros\Exception\UploadedFileErrorException` (extends `RuntimeException`) + +### Changed + +- [zendframework/zend-diactoros#329](https://github.com/zendframework/zend-diactoros/pull/329) adds return type hints and scalar parameter type hints wherever possible. + The changes were done to help improve code quality, in part by reducing manual + type checking. If you are extending any classes, you may need to update your + signatures; check the signatures of the class(es) you are extending for changes. + +- [zendframework/zend-diactoros#162](https://github.com/zendframework/zend-diactoros/pull/162) modifies `Serializer\Request` such that it now no longer raises an `UnexpectedValueException` via its `toString()` method + when an unexpected HTTP method is encountered; this can be done safely, as the value can never + be invalid due to other changes in the same patch. + +- [zendframework/zend-diactoros#162](https://github.com/zendframework/zend-diactoros/pull/162) modifies `RequestTrait` such that it now invalidates non-string method arguments to either + the constructor or `withMethod()`, raising an `InvalidArgumentException` for any that do not validate. + +### Deprecated + +- Nothing. + +### Removed + +- [zendframework/zend-diactoros#308](https://github.com/zendframework/zend-diactoros/pull/308) removes the following methods from the `ServerRequestFactory` class: + - `normalizeServer()` (use `Laminas\Diactoros\normalizeServer()` instead) + - `marshalHeaders()` (use `Laminas\Diactoros\marshalHeadersFromSapi()` instead) + - `marshalUriFromServer()` (use `Laminas\Diactoros\marshalUriFromSapi()` instead) + - `marshalRequestUri()` (use `Uri::getPath()` from the `Uri` instance returned by `marshalUriFromSapi()` instead) + - `marshalHostAndPortFromHeaders()` (use `Uri::getHost()` and `Uri::getPort()` from the `Uri` instances returned by `marshalUriFromSapi()` instead) + - `stripQueryString()` (use `explode("?", $path, 2)[0]` instead) + - `normalizeFiles()` (use `Laminas\Diactoros\normalizeUploadedFiles()` instead) + +- [zendframework/zend-diactoros#295](https://github.com/zendframework/zend-diactoros/pull/295) removes `Laminas\Diactoros\Server`. You can use the `RequestHandlerRunner` class from + [laminas/laminas-httphandlerrunner](https://docs.laminas.dev/laminas-httphandlerrunner) to provide these capabilities instead. + +- [zendframework/zend-diactoros#295](https://github.com/zendframework/zend-diactoros/pull/295) removes `Laminas\Diactoros\Response\EmitterInterface` and the various emitter implementations. + These can now be found in the package [laminas/laminas-httphandlerrunner](https://docs.laminas.dev/laminas-httphandlerrunner/), which also provides + a PSR-7-implementation agnostic way of using them. + +### Fixed + +- Nothing. + +## 1.8.7 - 2019-08-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#364](https://github.com/zendframework/zend-diactoros/issues/364) modifies detection of HTTPS schemas via the `$_SERVER['HTTPS']` value + such that an empty HTTPS-key will result in a scheme of `http` and not + `https`. + +## 1.8.6 - 2018-09-05 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#325](https://github.com/zendframework/zend-diactoros/pull/325) changes the behavior of `ServerRequest::withParsedBody()`. Per +- PSR-7, it now no longer allows values other than `null`, arrays, or objects. + +- [zendframework/zend-diactoros#325](https://github.com/zendframework/zend-diactoros/pull/325) changes the behavior of each of `Request`, `ServerRequest`, and + `Response` in relation to the validation of header values. Previously, we + allowed empty arrays to be provided via `withHeader()`; however, this was + contrary to the PSR-7 specification. Empty arrays are no longer allowed. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#325](https://github.com/zendframework/zend-diactoros/pull/325) ensures that `Uri::withUserInfo()` no longer ignores values of + `0` (numeric zero). + +- [zendframework/zend-diactoros#325](https://github.com/zendframework/zend-diactoros/pull/325) fixes how header values are merged when calling + `withAddedHeader()`, ensuring that array keys are ignored. + +## 1.8.5 - 2018-08-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#324](https://github.com/zendframework/zend-diactoros/pull/324) fixes a reference + to an undefined variable in the `ServerRequestFactory`, which made it + impossible to fetch a specific header by name. + +## 1.8.4 - 2018-08-01 + +### Added + +- Nothing. + +### Changed + +- This release modifies how `ServerRequestFactory` marshals the request URI. In + prior releases, we would attempt to inspect the `X-Rewrite-Url` and + `X-Original-Url` headers, using their values, if present. These headers are + issued by the ISAPI_Rewrite module for IIS (developed by HeliconTech). + However, we have no way of guaranteeing that the module is what issued the + headers, making it an unreliable source for discovering the URI. As such, we + have removed this feature in this release of Diactoros. + + If you are developing a middleware application, you can mimic the + functionality via middleware as follows: + + ```php + use Psr\Http\Message\ResponseInterface; + use Psr\Http\Message\ServerRequestInterface; + use Psr\Http\Server\RequestHandlerInterface; + use Laminas\Diactoros\Uri; + + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface + { + $requestUri = null; + + $httpXRewriteUrl = $request->getHeaderLine('X-Rewrite-Url'); + if ($httpXRewriteUrl !== null) { + $requestUri = $httpXRewriteUrl; + } + + $httpXOriginalUrl = $request->getHeaderLine('X-Original-Url'); + if ($httpXOriginalUrl !== null) { + $requestUri = $httpXOriginalUrl; + } + + if ($requestUri !== null) { + $request = $request->withUri(new Uri($requestUri)); + } + + return $handler->handle($request); + } + ``` + + If you use middleware such as the above, make sure you also instruct your web + server to strip any incoming headers of the same name so that you can + guarantee they are issued by the ISAPI_Rewrite module. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.8.3 - 2018-07-24 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#321](https://github.com/zendframework/zend-diactoros/pull/321) updates the logic in `Uri::withPort()` to ensure that it checks that the + value provided is either an integer or a string integer, as only those values + may be cast to integer without data loss. + +- [zendframework/zend-diactoros#320](https://github.com/zendframework/zend-diactoros/pull/320) adds checking within `Response` to ensure that the provided reason + phrase is a string; an `InvalidArgumentException` is now raised if it is not. This change + ensures the class adheres strictly to the PSR-7 specification. + +- [zendframework/zend-diactoros#319](https://github.com/zendframework/zend-diactoros/pull/319) provides a fix to `Laminas\Diactoros\Response` that ensures that the status + code returned is _always_ an integer (and never a string containing an + integer), thus ensuring it strictly adheres to the PSR-7 specification. + +## 1.8.2 - 2018-07-19 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#318](https://github.com/zendframework/zend-diactoros/pull/318) fixes the logic for discovering whether an HTTPS scheme is in play + to be case insensitive when comparing header and SAPI values, ensuring no + false negative lookups occur. + +- [zendframework/zend-diactoros#314](https://github.com/zendframework/zend-diactoros/pull/314) modifies error handling around opening a file resource within + `Laminas\Diactoros\Stream::setStream()` to no longer use the second argument to + `set_error_handler()`, and instead check the error type in the handler itself; + this fixes an issue when the handler is nested inside another error handler, + which currently has buggy behavior within the PHP engine. + +## 1.8.1 - 2018-07-09 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#313](https://github.com/zendframework/zend-diactoros/pull/313) changes the reason phrase associated with the status code 425 + to "Too Early", corresponding to a new definition of the code as specified by the IANA. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#312](https://github.com/zendframework/zend-diactoros/pull/312) fixes how the `normalizeUploadedFiles()` utility function handles nested trees of + uploaded files, ensuring it detects them properly. + +## 1.8.0 - 2018-06-27 + +### Added + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) adds the following functions under the `Laminas\Diactoros` namespace, each of + which may be used to derive artifacts from SAPI supergloabls for the purposes + of generating a `ServerRequest` instance: + - `normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array` + (main purpose is to aggregate the `Authorization` header in the SAPI params + when under Apache) + - `marshalProtocolVersionFromSapi(array $server) : string` + - `marshalMethodFromSapi(array $server) : string` + - `marshalUriFromSapi(array $server, array $headers) : Uri` + - `marshalHeadersFromSapi(array $server) : array` + - `parseCookieHeader(string $header) : array` + - `createUploadedFile(array $spec) : UploadedFile` (creates the instance from + a normal `$_FILES` entry) + - `normalizeUploadedFiles(array $files) : UploadedFileInterface[]` (traverses + a potentially nested array of uploaded file instances and/or `$_FILES` + entries, including those aggregated under mod_php, php-fpm, and php-cgi in + order to create a flat array of `UploadedFileInterface` instances to use in a + request) + +### Changed + +- Nothing. + +### Deprecated + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::normalizeServer()`; the method is + no longer used internally, and users should instead use `Laminas\Diactoros\normalizeServer()`, + to which it proxies. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalHeaders()`; the method is + no longer used internally, and users should instead use `Laminas\Diactoros\marshalHeadersFromSapi()`, + to which it proxies. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalUriFromServer()`; the method + is no longer used internally. Users should use `marshalUriFromSapi()` instead. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalRequestUri()`. the method is no longer + used internally, and currently proxies to `marshalUriFromSapi()`, pulling the + discovered path from the `Uri` instance returned by that function. Users + should use `marshalUriFromSapi()` instead. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalHostAndPortFromHeaders()`; the method + is no longer used internally, and currently proxies to `marshalUriFromSapi()`, + pulling the discovered host and port from the `Uri` instance returned by that + function. Users should use `marshalUriFromSapi()` instead. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::getHeader()`; the method is no longer + used internally. Users should copy and paste the functionality into their own + applications if needed, or rely on headers from a fully-populated `Uri` + instance instead. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::stripQueryString()`; the method is no longer + used internally, and users can mimic the functionality via the expression + `$path = explode('?', $path, 2)[0];`. + +- [zendframework/zend-diactoros#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::normalizeFiles()`; the functionality + is no longer used internally, and users can use `normalizeUploadedFiles()` as + a replacement. + +- [zendframework/zend-diactoros#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates `Laminas\Diactoros\Response\EmitterInterface` and its various implementations. These are now provided via the + [laminas/laminas-httphandlerrunner](https://docs.laminas.dev/laminas-httphandlerrunner) package as 1:1 substitutions. + +- [zendframework/zend-diactoros#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates the `Laminas\Diactoros\Server` class. Users are directed to the `RequestHandlerRunner` class from the + [laminas/laminas-httphandlerrunner](https://docs.laminas.dev/laminas-httphandlerrunner) package as an alternative. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.7.2 - 2018-05-29 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#301](https://github.com/zendframework/zend-diactoros/pull/301) adds stricter comparisons within the `uri` class to ensure non-empty + values are not treated as empty. + +## 1.7.1 - 2018-02-26 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#293](https://github.com/zendframework/zend-diactoros/pull/293) updates + `Uri::getHost()` to cast the value via `strtolower()` before returning it. + While this represents a change, it is fixing a bug in our implementation: + the PSR-7 specification for the method, which follows IETF RFC 3986 section + 3.2.2, requires that the host name be normalized to lowercase. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#290](https://github.com/zendframework/zend-diactoros/pull/290) fixes + `Stream::getSize()` such that it checks that the result of `fstat` was + succesful before attempting to return its `size` member; in the case of an + error, it now returns `null`. + +## 1.7.0 - 2018-01-04 + +### Added + +- [zendframework/zend-diactoros#285](https://github.com/zendframework/zend-diactoros/pull/285) adds a new + custom response type, `Laminas\Diactoros\Response\XmlResponse`, for generating + responses representing XML. Usage is the same as with the `HtmlResponse` or + `TextResponse`; the response generated will have a `Content-Type: + application/xml` header by default. + +- [zendframework/zend-diactoros#280](https://github.com/zendframework/zend-diactoros/pull/280) adds the + response status code/phrase pairing "103 Early Hints" to the + `Response::$phrases` property. This is a new status proposed via + [RFC 8297](https://datatracker.ietf.org/doc/rfc8297/). + +- [zendframework/zend-diactoros#279](https://github.com/zendframework/zend-diactoros/pull/279) adds explicit + support for PHP 7.2; previously, we'd allowed build failures, though none + occured; we now require PHP 7.2 builds to pass. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.6.1 - 2017-10-12 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#273](https://github.com/zendframework/zend-diactoros/pull/273) updates each + of the SAPI emitter implementations to emit the status line after emitting + other headers; this is done to ensure that the status line is not overridden + by PHP. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#273](https://github.com/zendframework/zend-diactoros/pull/273) modifies how + the `SapiEmitterTrait` calls `header()` to ensure that a response code is + _always_ passed as the third argument; this is done to prevent PHP from + silently overriding it. + +## 1.6.0 - 2017-09-13 + +### Added + +- Nothing. + +### Changed + +- [zendframework/zend-diactoros#270](https://github.com/zendframework/zend-diactoros/pull/270) changes the + behavior of `Laminas\Diactoros\Server`: it no longer creates an output buffer. + +- [zendframework/zend-diactoros#270](https://github.com/zendframework/zend-diactoros/pull/270) changes the + behavior of the two SAPI emitters in two backwards-incompatible ways: + + - They no longer auto-inject a `Content-Length` header. If you need this + functionality, mezzio/mezzio-helpers 4.1+ provides it via + `Mezzio\Helper\ContentLengthMiddleware`. + + - They no longer flush the output buffer. Instead, if headers have been sent, + or the output buffer exists and has a non-zero length, the emitters raise an + exception, as mixed PSR-7/output buffer content creates a blocking issue. + If you are emitting content via `echo`, `print`, `var_dump`, etc., or not + catching PHP errors or exceptions, you will need to either fix your + application to always work with a PSR-7 response, or provide your own + emitters that allow mixed output mechanisms. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.5.0 - 2017-08-22 + +### Added + +- [zendframework/zend-diactoros#205](https://github.com/zendframework/zend-diactoros/pull/205) adds support + for PHP 7.2. + +- [zendframework/zend-diactoros#250](https://github.com/zendframework/zend-diactoros/pull/250) adds a new + API to `JsonResponse` to avoid the need for decoding the response body in + order to make changes to the underlying content. New methods include: + - `getPayload()`: retrieve the unencoded payload. + - `withPayload($data)`: create a new instance with the given data. + - `getEncodingOptions()`: retrieve the flags to use when encoding the payload + to JSON. + - `withEncodingOptions(int $encodingOptions)`: create a new instance that uses + the provided flags when encoding the payload to JSON. + +### Changed + +- [zendframework/zend-diactoros#249](https://github.com/zendframework/zend-diactoros/pull/249) changes the + behavior of the various `Uri::with*()` methods slightly: if the value + represents no change, these methods will return the same instance instead of a + new one. + +- [zendframework/zend-diactoros#248](https://github.com/zendframework/zend-diactoros/pull/248) changes the + behavior of `Uri::getUserInfo()` slightly: it now (correctly) returns the + percent-encoded values for the user and/or password, per RFC 3986 Section + 3.2.1. `withUserInfo()` will percent-encode values, using a mechanism that + prevents double-encoding. + +- [zendframework/zend-diactoros#243](https://github.com/zendframework/zend-diactoros/pull/243) changes the + exception messages thrown by `UploadedFile::getStream()` and `moveTo()` when + an upload error exists to include details about the upload error. + +- [zendframework/zend-diactoros#233](https://github.com/zendframework/zend-diactoros/pull/233) adds a new + argument to `SapiStreamEmitter::emit`, `$maxBufferLevel` **between** the + `$response` and `$maxBufferLength` arguments. This was done because the + `Server::listen()` method passes only the response and `$maxBufferLevel` to + emitters; previously, this often meant that streams were being chunked 2 bytes + at a time versus the expected default of 8kb. + + If you were calling the `SapiStreamEmitter::emit()` method manually + previously, you will need to update your code. + +### Deprecated + +- Nothing. + +### Removed + +- [zendframework/zend-diactoros#205](https://github.com/zendframework/zend-diactoros/pull/205) and + [zendframework/zend-diactoros#243](https://github.com/zendframework/zend-diactoros/pull/243) **remove + support for PHP versions prior to 5.6 as well as HHVM**. + +### Fixed + +- [zendframework/zend-diactoros#248](https://github.com/zendframework/zend-diactoros/pull/248) fixes how the + `Uri` class provides user-info within the URI authority; the value is now + correctly percent-encoded , per RFC 3986 Section 3.2.1. + +## 1.4.1 - 2017-08-17 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [zendframework/zend-diactoros#260](https://github.com/zendframework/zend-diactoros/pull/260) removes + support for HHVM, as tests have failed against it for some time. + +### Fixed + +- [zendframework/zend-diactoros#247](https://github.com/zendframework/zend-diactoros/pull/247) fixes the + `Stream` and `RelativeStream` `__toString()` method implementations to check + if the stream `isSeekable()` before attempting to `rewind()` it, ensuring that + the method does not raise exceptions (PHP does not allow exceptions in that + method). In particular, this fixes an issue when using AWS S3 streams. + +- [zendframework/zend-diactoros#252](https://github.com/zendframework/zend-diactoros/pull/252) provides a + fix to the `SapiEmitterTrait` to ensure that any `Set-Cookie` headers in the + response instance do not override those set by PHP when a session is created + and/or regenerated. + +- [zendframework/zend-diactoros#257](https://github.com/zendframework/zend-diactoros/pull/257) provides a + fix for the `PhpInputStream::read()` method to ensure string content that + evaluates as empty (including `0`) is still cached. + +- [zendframework/zend-diactoros#258](https://github.com/zendframework/zend-diactoros/pull/258) updates the + `Uri::filterPath()` method to allow parens within a URI path, per [RFC 3986 + section 3.3](https://tools.ietf.org/html/rfc3986#section-3.3) (parens are + within the character set "sub-delims"). + +## 1.4.0 - 2017-04-06 + +### Added + +- [zendframework/zend-diactoros#219](https://github.com/zendframework/zend-diactoros/pull/219) adds two new + classes, `Laminas\Diactoros\Request\ArraySerializer` and + `Laminas\Diactoros\Response\ArraySerializer`. Each exposes the static methods + `toArray()` and `fromArray()`, allowing de/serialization of messages from and + to arrays. + +- [zendframework/zend-diactoros#236](https://github.com/zendframework/zend-diactoros/pull/236) adds two new + constants to the `Response` class: `MIN_STATUS_CODE_VALUE` and + `MAX_STATUS_CODE_VALUE`. + +### Changes + +- [zendframework/zend-diactoros#240](https://github.com/zendframework/zend-diactoros/pull/240) changes the + behavior of `ServerRequestFactory::fromGlobals()` when no `$cookies` argument + is present. Previously, it would use `$_COOKIES`; now, if a `Cookie` header is + present, it will parse and use that to populate the instance instead. + + This change allows utilizing cookies that contain period characters (`.`) in + their names (PHP's built-in cookie handling renames these to replace `.` with + `_`, which can lead to synchronization issues with clients). + +- [zendframework/zend-diactoros#235](https://github.com/zendframework/zend-diactoros/pull/235) changes the + behavior of `Uri::__toString()` to better follow proscribed behavior in PSR-7. + In particular, prior to this release, if a scheme was missing but an authority + was present, the class was incorrectly returning a value that did not include + a `//` prefix. As of this release, it now does this correctly. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.3.11 - 2017-04-06 + +### Added + +- Nothing. + +### Changes + +- [zendframework/zend-diactoros#241](https://github.com/zendframework/zend-diactoros/pull/241) changes the + constraint by which the package provides `psr/http-message-implementation` to + simply `1.0` instead of `~1.0.0`, to follow how other implementations provide + PSR-7. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#161](https://github.com/zendframework/zend-diactoros/pull/161) adds + additional validations to header names and values to ensure no malformed values + are provided. + +- [zendframework/zend-diactoros#234](https://github.com/zendframework/zend-diactoros/pull/234) fixes a + number of reason phrases in the `Response` instance, and adds automation from + the canonical IANA sources to ensure any new phrases added are correct. + +## 1.3.10 - 2017-01-23 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#226](https://github.com/zendframework/zend-diactoros/pull/226) fixed an + issue with the `SapiStreamEmitter` causing the response body to be cast + to `(string)` and also be read as a readable stream, potentially producing + double output. + +## 1.3.9 - 2017-01-17 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#223](https://github.com/zendframework/zend-diactoros/issues/223) + [zendframework/zend-diactoros#224](https://github.com/zendframework/zend-diactoros/pull/224) fixed an issue + with the `SapiStreamEmitter` consuming too much memory when producing output + for readable bodies. + +## 1.3.8 - 2017-01-05 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#222](https://github.com/zendframework/zend-diactoros/pull/222) fixes the + `SapiStreamEmitter`'s handling of the `Content-Range` header to properly only + emit a range of bytes if the header value is in the form `bytes {first-last}/length`. + This allows using other range units, such as `items`, without incorrectly + emitting truncated content. + +## 1.3.7 - 2016-10-11 + +### Added + +- [zendframework/zend-diactoros#208](https://github.com/zendframework/zend-diactoros/pull/208) adds several + missing response codes to `Laminas\Diactoros\Response`, including: + - 226 ('IM used') + - 308 ('Permanent Redirect') + - 444 ('Connection Closed Without Response') + - 499 ('Client Closed Request') + - 510 ('Not Extended') + - 599 ('Network Connect Timeout Error') +- [zendframework/zend-diactoros#211](https://github.com/zendframework/zend-diactoros/pull/211) adds support + for UTF-8 characters in query strings handled by `Laminas\Diactoros\Uri`. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.3.6 - 2016-09-07 + +### Added + +- [zendframework/zend-diactoros#170](https://github.com/zendframework/zend-diactoros/pull/170) prepared + documentation for publication at https://docs.laminas.dev/laminas-diactoros/ +- [zendframework/zend-diactoros#165](https://github.com/zendframework/zend-diactoros/pull/165) adds support + for Apache `REDIRECT_HTTP_*` header detection in the `ServerRequestFactory`. +- [zendframework/zend-diactoros#166](https://github.com/zendframework/zend-diactoros/pull/166) adds support + for UTF-8 characters in URI paths. +- [zendframework/zend-diactoros#204](https://github.com/zendframework/zend-diactoros/pull/204) adds testing + against PHP 7.1 release-candidate builds. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#186](https://github.com/zendframework/zend-diactoros/pull/186) fixes a typo + in a variable name within the `SapiStreamEmitter`. +- [zendframework/zend-diactoros#200](https://github.com/zendframework/zend-diactoros/pull/200) updates the + `SapiStreamEmitter` to implement a check for `isSeekable()` prior to attempts + to rewind; this allows it to work with non-seekable streams such as the + `CallbackStream`. +- [zendframework/zend-diactoros#169](https://github.com/zendframework/zend-diactoros/pull/169) ensures that + response serialization always provides a `\r\n\r\n` sequence following the + headers, even when no message body is present, to ensure it conforms with RFC + 7230. +- [zendframework/zend-diactoros#175](https://github.com/zendframework/zend-diactoros/pull/175) updates the + `Request` class to set the `Host` header from the URI host if no header is + already present. (Ensures conformity with PSR-7 specification.) +- [zendframework/zend-diactoros#197](https://github.com/zendframework/zend-diactoros/pull/197) updates the + `Uri` class to ensure that string serialization does not include a colon after + the host name if no port is present in the instance. + +## 1.3.5 - 2016-03-17 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#160](https://github.com/zendframework/zend-diactoros/pull/160) fixes HTTP + protocol detection in the `ServerRequestFactory` to work correctly with HTTP/2. + +## 1.3.4 - 2016-03-17 + +### Added + +- [zendframework/zend-diactoros#119](https://github.com/zendframework/zend-diactoros/pull/119) adds the 451 + (Unavailable for Legal Reasons) status code to the `Response` class. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#117](https://github.com/zendframework/zend-diactoros/pull/117) provides + validation of the HTTP protocol version. +- [zendframework/zend-diactoros#127](https://github.com/zendframework/zend-diactoros/pull/127) now properly + removes attributes with `null` values when calling `withoutAttribute()`. +- [zendframework/zend-diactoros#132](https://github.com/zendframework/zend-diactoros/pull/132) updates the + `ServerRequestFactory` to marshal the request path fragment, if present. +- [zendframework/zend-diactoros#142](https://github.com/zendframework/zend-diactoros/pull/142) updates the + exceptions thrown by `HeaderSecurity` to include the header name and/or + value. +- [zendframework/zend-diactoros#148](https://github.com/zendframework/zend-diactoros/pull/148) fixes several + stream operations to ensure they raise exceptions when the internal pointer + is at an invalid position. +- [zendframework/zend-diactoros#151](https://github.com/zendframework/zend-diactoros/pull/151) ensures + URI fragments are properly encoded. + +## 1.3.3 - 2016-01-04 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#135](https://github.com/zendframework/zend-diactoros/pull/135) fixes the + behavior of `ServerRequestFactory::marshalHeaders()` to no longer omit + `Cookie` headers from the aggregated headers. While the values are parsed and + injected into the cookie params, it's useful to have access to the raw headers + as well. + +## 1.3.2 - 2015-12-22 + +### Added + +- [zendframework/zend-diactoros#124](https://github.com/zendframework/zend-diactoros/pull/124) adds four + more optional arguments to the `ServerRequest` constructor: + - `array $cookies` + - `array $queryParams` + - `null|array|object $parsedBody` + - `string $protocolVersion` + `ServerRequestFactory` was updated to pass values for each of these parameters + when creating an instance, instead of using the related `with*()` methods on + an instance. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#122](https://github.com/zendframework/zend-diactoros/pull/122) updates the + `ServerRequestFactory` to retrieve the HTTP protocol version and inject it in + the generated `ServerRequest`, which previously was not performed. + +## 1.3.1 - 2015-12-16 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#113](https://github.com/zendframework/zend-diactoros/pull/113) fixes an + issue in the response serializer, ensuring that the status code in the + deserialized response is an integer. +- [zendframework/zend-diactoros#115](https://github.com/zendframework/zend-diactoros/pull/115) fixes an + issue in the various text-basd response types (`TextResponse`, `HtmlResponse`, + and `JsonResponse`); due to the fact that the constructor was not + rewinding the message body stream, `getContents()` was thus returning `null`, + as the pointer was at the end of the stream. The constructor now rewinds the + stream after populating it in the constructor. + +## 1.3.0 - 2015-12-15 + +### Added + +- [zendframework/zend-diactoros#110](https://github.com/zendframework/zend-diactoros/pull/110) adds + `Laminas\Diactoros\Response\SapiEmitterTrait`, which provides the following + private method definitions: + - `injectContentLength()` + - `emitStatusLine()` + - `emitHeaders()` + - `flush()` + - `filterHeader()` + The `SapiEmitter` implementation has been updated to remove those methods and + instead compose the trait. +- [zendframework/zend-diactoros#111](https://github.com/zendframework/zend-diactoros/pull/111) adds + a new emitter implementation, `SapiStreamEmitter`; this emitter type will + loop through the stream instead of emitting it in one go, and supports content + ranges. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.2.1 - 2015-12-15 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#101](https://github.com/zendframework/zend-diactoros/pull/101) fixes the + `withHeader()` implementation to ensure that if the header existed previously + but using a different casing strategy, the previous version will be removed + in the cloned instance. +- [zendframework/zend-diactoros#103](https://github.com/zendframework/zend-diactoros/pull/103) fixes the + constructor of `Response` to ensure that null status codes are not possible. +- [zendframework/zend-diactoros#99](https://github.com/zendframework/zend-diactoros/pull/99) fixes + validation of header values submitted via request and response constructors as + follows: + - numeric (integer and float) values are now properly allowed (this solves + some reported issues with setting Content-Length headers) + - invalid header names (non-string values or empty strings) now raise an + exception. + - invalid individual header values (non-string, non-numeric) now raise an + exception. + +## 1.2.0 - 2015-11-24 + +### Added + +- [zendframework/zend-diactoros#88](https://github.com/zendframework/zend-diactoros/pull/88) updates the + `SapiEmitter` to emit a `Content-Length` header with the content length as + reported by the response body stream, assuming that + `StreamInterface::getSize()` returns an integer. +- [zendframework/zend-diactoros#77](https://github.com/zendframework/zend-diactoros/pull/77) adds a new + response type, `Laminas\Diactoros\Response\TextResponse`, for returning plain + text responses. By default, it sets the content type to `text/plain; + charset=utf-8`; per the other response types, the signature is `new + TextResponse($text, $status = 200, array $headers = [])`. +- [zendframework/zend-diactoros#90](https://github.com/zendframework/zend-diactoros/pull/90) adds a new + `Laminas\Diactoros\CallbackStream`, allowing you to back a stream with a PHP + callable (such as a generator) to generate the message content. Its + constructor accepts the callable: `$stream = new CallbackStream($callable);` + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#77](https://github.com/zendframework/zend-diactoros/pull/77) updates the + `HtmlResponse` to set the charset to utf-8 by default (if no content type + header is provided at instantiation). + +## 1.1.4 - 2015-10-16 + +### Added + +- [zendframework/zend-diactoros#98](https://github.com/zendframework/zend-diactoros/pull/98) adds + `JSON_UNESCAPED_SLASHES` to the default `json_encode` flags used by + `Laminas\Diactoros\Response\JsonResponse`. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#96](https://github.com/zendframework/zend-diactoros/pull/96) updates + `withPort()` to allow `null` port values (indicating usage of default for + the given scheme). +- [zendframework/zend-diactoros#91](https://github.com/zendframework/zend-diactoros/pull/91) fixes the + logic of `withUri()` to do a case-insensitive check for an existing `Host` + header, replacing it with the new one. + +## 1.1.3 - 2015-08-10 + +### Added + +- [zendframework/zend-diactoros#73](https://github.com/zendframework/zend-diactoros/pull/73) adds caching of + the vendor directory to the Travis-CI configuration, to speed up builds. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#71](https://github.com/zendframework/zend-diactoros/pull/71) fixes the + docblock of the `JsonResponse` constructor to typehint the `$data` argument + as `mixed`. +- [zendframework/zend-diactoros#73](https://github.com/zendframework/zend-diactoros/pull/73) changes the + behavior in `Request` such that if it marshals a stream during instantiation, + the stream is marked as writeable (specifically, mode `wb+`). +- [zendframework/zend-diactoros#85](https://github.com/zendframework/zend-diactoros/pull/85) updates the + behavior of `Laminas\Diactoros\Uri`'s various `with*()` methods that are + documented as accepting strings to raise exceptions on non-string input. + Previously, several simply passed non-string input on verbatim, others + normalized the input, and a few correctly raised the exceptions. Behavior is + now consistent across each. +- [zendframework/zend-diactoros#87](https://github.com/zendframework/zend-diactoros/pull/87) fixes + `UploadedFile` to ensure that `moveTo()` works correctly in non-SAPI + environments when the file provided to the constructor is a path. + +## 1.1.2 - 2015-07-12 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#67](https://github.com/zendframework/zend-diactoros/pull/67) ensures that + the `Stream` class only accepts `stream` resources, not any resource. + +## 1.1.1 - 2015-06-25 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#64](https://github.com/zendframework/zend-diactoros/pull/64) fixes the + behavior of `JsonResponse` with regards to serialization of `null` and scalar + values; the new behavior is to serialize them verbatim, without any casting. + +## 1.1.0 - 2015-06-24 + +### Added + +- [zendframework/zend-diactoros#52](https://github.com/zendframework/zend-diactoros/pull/52), + [zendframework/zend-diactoros#58](https://github.com/zendframework/zend-diactoros/pull/58), + [zendframework/zend-diactoros#59](https://github.com/zendframework/zend-diactoros/pull/59), and + [zendframework/zend-diactoros#61](https://github.com/zendframework/zend-diactoros/pull/61) create several + custom response types for simplifying response creation: + + - `Laminas\Diactoros\Response\HtmlResponse` accepts HTML content via its + constructor, and sets the `Content-Type` to `text/html`. + - `Laminas\Diactoros\Response\JsonResponse` accepts data to serialize to JSON via + its constructor, and sets the `Content-Type` to `application/json`. + - `Laminas\Diactoros\Response\EmptyResponse` allows creating empty, read-only + responses, with a default status code of 204. + - `Laminas\Diactoros\Response\RedirectResponse` allows specifying a URI for the + `Location` header in the constructor, with a default status code of 302. + + Each also accepts an optional status code, and optional headers (which can + also be used to provide an alternate `Content-Type` in the case of the HTML + and JSON responses). + +### Deprecated + +- Nothing. + +### Removed + +- [zendframework/zend-diactoros#43](https://github.com/zendframework/zend-diactoros/pull/43) removed both + `ServerRequestFactory::marshalUri()` and `ServerRequestFactory::marshalHostAndPort()`, + which were deprecated prior to the 1.0 release. + +### Fixed + +- [zendframework/zend-diactoros#29](https://github.com/zendframework/zend-diactoros/pull/29) fixes request + method validation to allow any valid token as defined by [RFC + 7230](http://tools.ietf.org/html/rfc7230#appendix-B). This allows usage of + custom request methods, vs a static, hard-coded list. + +## 1.0.5 - 2015-06-24 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#60](https://github.com/zendframework/zend-diactoros/pull/60) fixes + the behavior of `UploadedFile` when the `$errorStatus` provided at + instantiation is not `UPLOAD_ERR_OK`. Prior to the fix, an + `InvalidArgumentException` would occur at instantiation due to the fact that + the upload file was missing or invalid. With the fix, no exception is raised + until a call to `moveTo()` or `getStream()` is made. + +## 1.0.4 - 2015-06-23 + +This is a security release. + +A patch has been applied to `Laminas\Diactoros\Uri::filterPath()` that ensures that +paths can only begin with a single leading slash. This prevents the following +potential security issues: + +- XSS vectors. If the URI path is used for links or form targets, this prevents + cases where the first segment of the path resembles a domain name, thus + creating scheme-relative links such as `//example.com/foo`. With the patch, + the leading double slash is reduced to a single slash, preventing the XSS + vector. +- Open redirects. If the URI path is used for `Location` or `Link` headers, + without a scheme and authority, potential for open redirects exist if clients + do not prepend the scheme and authority. Again, preventing a double slash + corrects the vector. + +If you are using `Laminas\Diactoros\Uri` for creating links, form targets, or +redirect paths, and only using the path segment, we recommend upgrading +immediately. + +### Added + +- [zendframework/zend-diactoros#25](https://github.com/zendframework/zend-diactoros/pull/25) adds + documentation. Documentation is written in markdown, and can be converted to + HTML using [bookdown](http://bookdown.io). New features now MUST include + documentation for acceptance. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#51](https://github.com/zendframework/zend-diactoros/pull/51) fixes + `MessageTrait::getHeaderLine()` to return an empty string instead of `null` if + the header is undefined (which is the behavior specified in PSR-7). +- [zendframework/zend-diactoros#57](https://github.com/zendframework/zend-diactoros/pull/57) fixes the + behavior of how the `ServerRequestFactory` marshals upload files when they are + represented as a nested associative array. +- [zendframework/zend-diactoros#49](https://github.com/zendframework/zend-diactoros/pull/49) provides several + fixes that ensure that Diactoros complies with the PSR-7 specification: + - `MessageInterface::getHeaderLine()` MUST return a string (that string CAN be + empty). Previously, Diactoros would return `null`. + - If no `Host` header is set, the `$preserveHost` flag MUST be ignored when + calling `withUri()` (previously, Diactoros would not set the `Host` header + if `$preserveHost` was `true`, but no `Host` header was present). + - The request method MUST be a string; it CAN be empty. Previously, Diactoros + would return `null`. + - The request MUST return a `UriInterface` instance from `getUri()`; that + instance CAN be empty. Previously, Diactoros would return `null`; now it + lazy-instantiates an empty `Uri` instance on initialization. +- [ZF2015-05](https://getlaminas.org/security/advisory/ZF2015-05) was + addressed by altering `Uri::filterPath()` to prevent emitting a path prepended + with multiple slashes. + +## 1.0.3 - 2015-06-04 + +### Added + +- [zendframework/zend-diactoros#48](https://github.com/zendframework/zend-diactoros/pull/48) drops the + minimum supported PHP version to 5.4, to allow an easier upgrade path for + Symfony 2.7 users, and potential Drupal 8 usage. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.0.2 - 2015-06-04 + +### Added + +- [zendframework/zend-diactoros#27](https://github.com/zendframework/zend-diactoros/pull/27) adds phonetic + pronunciation of "Diactoros" to the README file. +- [zendframework/zend-diactoros#36](https://github.com/zendframework/zend-diactoros/pull/36) adds property + annotations to the class-level docblock of `Laminas\Diactoros\RequestTrait` to + ensure properties inherited from the `MessageTrait` are inherited by + implementations. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. +- +### Fixed + +- [zendframework/zend-diactoros#41](https://github.com/zendframework/zend-diactoros/pull/41) fixes the + namespace for test files to begin with `LaminasTest` instead of `Laminas`. +- [zendframework/zend-diactoros#46](https://github.com/zendframework/zend-diactoros/pull/46) ensures that + the cookie and query params for the `ServerRequest` implementation are + initialized as arrays. +- [zendframework/zend-diactoros#47](https://github.com/zendframework/zend-diactoros/pull/47) modifies the + internal logic in `HeaderSecurity::isValid()` to use a regular expression + instead of character-by-character comparisons, improving performance. + +## 1.0.1 - 2015-05-26 + +### Added + +- [zendframework/zend-diactoros#10](https://github.com/zendframework/zend-diactoros/pull/10) adds + `Laminas\Diactoros\RelativeStream`, which will return stream contents relative to + a given offset (i.e., a subset of the stream). `AbstractSerializer` was + updated to create a `RelativeStream` when creating the body of a message, + which will prevent duplication of the stream in-memory. +- [zendframework/zend-diactoros#21](https://github.com/zendframework/zend-diactoros/pull/21) adds a + `.gitattributes` file that excludes directories and files not needed for + production; this will further minify the package for production use cases. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [zendframework/zend-diactoros#9](https://github.com/zendframework/zend-diactoros/pull/9) ensures that + attributes are initialized to an empty array, ensuring that attempts to + retrieve single attributes when none are defined will not produce errors. +- [zendframework/zend-diactoros#14](https://github.com/zendframework/zend-diactoros/pull/14) updates + `Laminas\Diactoros\Request` to use a `php://temp` stream by default instead of + `php://memory`, to ensure requests do not create an out-of-memory condition. +- [zendframework/zend-diactoros#15](https://github.com/zendframework/zend-diactoros/pull/15) updates + `Laminas\Diactoros\Stream` to ensure that write operations trigger an exception + if the stream is not writeable. Additionally, it adds more robust logic for + determining if a stream is writeable. + +## 1.0.0 - 2015-05-21 + +First stable release, and first release as `laminas-diactoros`. + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/COPYRIGHT.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/COPYRIGHT.md new file mode 100644 index 0000000000..0a8cccc06b --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/COPYRIGHT.md @@ -0,0 +1 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/LICENSE.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/LICENSE.md new file mode 100644 index 0000000000..10b40f1423 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/README.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/README.md new file mode 100644 index 0000000000..1319b2bc7c --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/README.md @@ -0,0 +1,36 @@ +# laminas-diactoros + +Master: +[![Build status][Master image]][Master] +[![Coverage Status][Master coverage image]][Master coverage] +Develop: +[![Build status][Develop image]][Develop] +[![Coverage Status][Develop coverage image]][Develop coverage] + +> Diactoros (pronunciation: `/dɪʌktɒrɒs/`): an epithet for Hermes, meaning literally, "the messenger." + +This package supercedes and replaces [phly/http](https://github.com/phly/http). + +`laminas-diactoros` is a PHP package containing implementations of the +[PSR-7 HTTP message interfaces](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md) +and [PSR-17 HTTP message factory interfaces](https://www.php-fig.org/psr/psr-17). + +* File issues at https://github.com/laminas/laminas-diactoros/issues +* Issue patches to https://github.com/laminas/laminas-diactoros/pulls + +## Documentation + +Documentation is available at: + +- https://docs.laminas.dev/laminas-diactoros/ + +Source files for documentation are [in the docs/ tree](docs/). + + [Master]: https://travis-ci.com/laminas/laminas-diactoros + [Master image]: https://travis-ci.com/laminas/laminas-diactoros.svg?branch=master + [Master coverage image]: https://img.shields.io/coveralls/laminas/laminas-diactoros/master.svg + [Master coverage]: https://coveralls.io/r/laminas/laminas-diactoros?branch=master + [Develop]: https://github.com/laminas/laminas-diactoros/tree/develop + [Develop image]: https://travis-ci.com/laminas/laminas-diactoros.svg?branch=develop + [Develop coverage image]: https://coveralls.io/repos/laminas/laminas-diactoros/badge.svg?branch=develop + [Develop coverage]: https://coveralls.io/r/laminas/laminas-diactoros?branch=develop 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 new file mode 100644 index 0000000000..3ec4db4693 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/composer.json @@ -0,0 +1,94 @@ +{ + "name": "laminas/laminas-diactoros", + "description": "PSR HTTP Message implementations", + "license": "BSD-3-Clause", + "keywords": [ + "laminas", + "http", + "psr", + "psr-7", + "psr-17" + ], + "homepage": "https://laminas.dev", + "support": { + "docs": "https://docs.laminas.dev/laminas-diactoros/", + "issues": "https://github.com/laminas/laminas-diactoros/issues", + "source": "https://github.com/laminas/laminas-diactoros", + "rss": "https://github.com/laminas/laminas-diactoros/releases.atom", + "chat": "https://laminas.dev/chat", + "forum": "https://discourse.laminas.dev" + }, + "config": { + "sort-packages": true + }, + "extra": { + "laminas": { + "config-provider": "Laminas\\Diactoros\\ConfigProvider", + "module": "Laminas\\Diactoros" + } + }, + "require": { + "php": "^7.1", + "laminas/laminas-zendframework-bridge": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "ext-curl": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-libxml": "*", + "http-interop/http-factory-tests": "^0.5.0", + "laminas/laminas-coding-standard": "~1.0.0", + "php-http/psr7-integration-tests": "^1.0", + "phpunit/phpunit": "^7.5.18" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php", + "src/functions/create_uploaded_file.legacy.php", + "src/functions/marshal_headers_from_sapi.legacy.php", + "src/functions/marshal_method_from_sapi.legacy.php", + "src/functions/marshal_protocol_version_from_sapi.legacy.php", + "src/functions/marshal_uri_from_sapi.legacy.php", + "src/functions/normalize_server.legacy.php", + "src/functions/normalize_uploaded_files.legacy.php", + "src/functions/parse_cookie_header.legacy.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "LaminasTest\\Diactoros\\": "test/" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" + }, + "replace": { + "zendframework/zend-diactoros": "^2.2.1" + } +} 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 new file mode 100644 index 0000000000..cc8a110f4a --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/AbstractSerializer.php @@ -0,0 +1,150 @@ +eof()) { + $char = $stream->read(1); + + if ($crFound && $char === self::LF) { + $crFound = false; + break; + } + + // CR NOT followed by LF + if ($crFound && $char !== self::LF) { + throw Exception\DeserializationException::forUnexpectedCarriageReturn(); + } + + // LF in isolation + if (! $crFound && $char === self::LF) { + throw Exception\DeserializationException::forUnexpectedLineFeed(); + } + + // CR found; do not append + if ($char === self::CR) { + $crFound = true; + continue; + } + + // Any other character: append + $line .= $char; + } + + // CR found at end of stream + if ($crFound) { + throw Exception\DeserializationException::forUnexpectedEndOfHeaders(); + } + + return $line; + } + + /** + * Split the stream into headers and body content. + * + * Returns an array containing two elements + * + * - The first is an array of headers + * - The second is a StreamInterface containing the body content + * + * @throws Exception\DeserializationException For invalid headers. + */ + protected static function splitStream(StreamInterface $stream) : array + { + $headers = []; + $currentHeader = false; + + while ($line = self::getLine($stream)) { + if (preg_match(';^(?P[!#$%&\'*+.^_`\|~0-9a-zA-Z-]+):(?P.*)$;', $line, $matches)) { + $currentHeader = $matches['name']; + if (! isset($headers[$currentHeader])) { + $headers[$currentHeader] = []; + } + $headers[$currentHeader][] = ltrim($matches['value']); + continue; + } + + if (! $currentHeader) { + throw Exception\DeserializationException::forInvalidHeader(); + } + + if (! preg_match('#^[ \t]#', $line)) { + throw Exception\DeserializationException::forInvalidHeaderContinuation(); + } + + // Append continuation to last header value found + $value = array_pop($headers[$currentHeader]); + $headers[$currentHeader][] = $value . ltrim($line); + } + + // use RelativeStream to avoid copying initial stream into memory + return [$headers, new RelativeStream($stream, $stream->tell())]; + } + + /** + * Serialize headers to string values. + */ + protected static function serializeHeaders(array $headers) : string + { + $lines = []; + foreach ($headers as $header => $values) { + $normalized = self::filterHeader($header); + foreach ($values as $value) { + $lines[] = sprintf('%s: %s', $normalized, $value); + } + } + + return implode("\r\n", $lines); + } + + /** + * Filter a header name to wordcase + */ + protected static function filterHeader($header) : string + { + $filtered = str_replace('-', ' ', $header); + $filtered = ucwords($filtered); + return str_replace(' ', '-', $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 new file mode 100644 index 0000000000..48ae1bdd67 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/CallbackStream.php @@ -0,0 +1,183 @@ +attach($callback); + } + + /** + * {@inheritdoc} + */ + public function __toString() : string + { + return $this->getContents(); + } + + /** + * {@inheritdoc} + */ + public function close() : void + { + $this->callback = null; + } + + /** + * {@inheritdoc} + */ + public function detach() : ?callable + { + $callback = $this->callback; + $this->callback = null; + return $callback; + } + + /** + * Attach a new callback to the instance. + */ + public function attach(callable $callback) : void + { + $this->callback = $callback; + } + + /** + * {@inheritdoc} + */ + public function getSize() : ?int + { + return null; + } + + /** + * {@inheritdoc} + */ + public function tell() : int + { + throw Exception\UntellableStreamException::forCallbackStream(); + } + + /** + * {@inheritdoc} + */ + public function eof() : bool + { + return empty($this->callback); + } + + /** + * {@inheritdoc} + */ + public function isSeekable() : bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + throw Exception\UnseekableStreamException::forCallbackStream(); + } + + /** + * {@inheritdoc} + */ + public function rewind() : void + { + throw Exception\UnrewindableStreamException::forCallbackStream(); + } + + /** + * {@inheritdoc} + */ + public function isWritable() : bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function write($string) : void + { + throw Exception\UnwritableStreamException::forCallbackStream(); + } + + /** + * {@inheritdoc} + */ + public function isReadable() : bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function read($length) : string + { + throw Exception\UnreadableStreamException::forCallbackStream(); + } + + /** + * {@inheritdoc} + */ + public function getContents() : string + { + $callback = $this->detach(); + $contents = $callback ? $callback() : ''; + return (string) $contents; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($key = null) + { + $metadata = [ + 'eof' => $this->eof(), + 'stream_type' => 'callback', + 'seekable' => false + ]; + + if (null === $key) { + return $metadata; + } + + if (! array_key_exists($key, $metadata)) { + return null; + } + + return $metadata[$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 new file mode 100644 index 0000000000..bc422dad4c --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ConfigProvider.php @@ -0,0 +1,51 @@ + $this->getDependencies(), + ]; + } + + /** + * Returns the container dependencies. + * Maps factory interfaces to factories. + */ + public function getDependencies() : array + { + return [ + 'invokables' => [ + RequestFactoryInterface::class => RequestFactory::class, + ResponseFactoryInterface::class => ResponseFactory::class, + StreamFactoryInterface::class => StreamFactory::class, + ServerRequestFactoryInterface::class => ServerRequestFactory::class, + UploadedFileFactoryInterface::class => UploadedFileFactory::class, + UriFactoryInterface::class => UriFactory::class + ], + ]; + } +} 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 new file mode 100644 index 0000000000..6ae6b431e5 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/DeserializationException.php @@ -0,0 +1,52 @@ +getCode(), $previous); + } + + public static function forResponseFromArray(Throwable $previous) : self + { + return new self('Cannot deserialize response', $previous->getCode(), $previous); + } + + public static function forUnexpectedCarriageReturn() : self + { + throw new self('Unexpected carriage return detected'); + } + + public static function forUnexpectedEndOfHeaders() : self + { + throw new self('Unexpected end of headers'); + } + + 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/ExceptionInterface.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php new file mode 100644 index 0000000000..3d7648efa0 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Exception/ExceptionInterface.php @@ -0,0 +1,20 @@ + 254 + ) { + continue; + } + + $string .= $value[$i]; + } + + return $string; + } + + /** + * Validate a header value. + * + * Per RFC 7230, only VISIBLE ASCII characters, spaces, and horizontal + * 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 + */ + public static function isValid($value) : bool + { + $value = (string) $value; + + // Look for: + // \n not preceded by \r, OR + // \r not followed by \n, OR + // \r\n not followed by space or horizontal tab; these are all CRLF attacks + if (preg_match("#(?:(?:(? array of values. + * + * @var array + */ + protected $headers = []; + + /** + * Map of normalized header name to original name used to register header. + * + * @var array + */ + protected $headerNames = []; + + /** + * @var string + */ + private $protocol = '1.1'; + + /** + * @var StreamInterface + */ + private $stream; + + /** + * Retrieves the HTTP protocol version as a string. + * + * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0"). + * + * @return string HTTP protocol version. + */ + public function getProtocolVersion() : string + { + return $this->protocol; + } + + /** + * Return an instance with the specified HTTP protocol version. + * + * The version string MUST contain only the HTTP version number (e.g., + * "1.1", "1.0"). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new protocol version. + * + * @param string $version HTTP protocol version + * @return static + */ + public function withProtocolVersion($version) : MessageInterface + { + $this->validateProtocolVersion($version); + $new = clone $this; + $new->protocol = $version; + return $new; + } + + /** + * Retrieves all message headers. + * + * The keys represent the header name as it will be sent over the wire, and + * each value is an array of strings associated with the header. + * + * // Represent the headers as a string + * foreach ($message->getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * @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. + */ + public function getHeaders() : array + { + return $this->headers; + } + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $header Case-insensitive header name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader($header) : bool + { + return isset($this->headerNames[strtolower($header)]); + } + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $header Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader($header) : array + { + if (! $this->hasHeader($header)) { + return []; + } + + $header = $this->headerNames[strtolower($header)]; + + return $this->headers[$header]; + } + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * 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 + { + $value = $this->getHeader($name); + if (empty($value)) { + return ''; + } + + return implode(',', $value); + } + + /** + * Return an instance with the provided header, replacing any existing + * values of any headers with the same case-insensitive name. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $header Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws Exception\InvalidArgumentException for invalid header names or values. + */ + public function withHeader($header, $value) : MessageInterface + { + $this->assertHeader($header); + + $normalized = strtolower($header); + + $new = clone $this; + if ($new->hasHeader($header)) { + unset($new->headers[$new->headerNames[$normalized]]); + } + + $value = $this->filterHeaderValue($value); + + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + /** + * Return an instance with the specified header appended with the + * given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $header 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. + */ + public function withAddedHeader($header, $value) : MessageInterface + { + $this->assertHeader($header); + + if (! $this->hasHeader($header)) { + return $this->withHeader($header, $value); + } + + $header = $this->headerNames[strtolower($header)]; + + $new = clone $this; + $value = $this->filterHeaderValue($value); + $new->headers[$header] = array_merge($this->headers[$header], $value); + return $new; + } + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $header Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader($header) : MessageInterface + { + if (! $this->hasHeader($header)) { + return clone $this; + } + + $normalized = strtolower($header); + $original = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$original], $new->headerNames[$normalized]); + return $new; + } + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody() : StreamInterface + { + return $this->stream; + } + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws Exception\InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body) : MessageInterface + { + $new = clone $this; + $new->stream = $body; + return $new; + } + + private function getStream($stream, string $modeIfNotInstance) : StreamInterface + { + if ($stream instanceof StreamInterface) { + return $stream; + } + + if (! is_string($stream) && ! is_resource($stream)) { + throw new Exception\InvalidArgumentException( + 'Stream must be a string stream resource identifier, ' + . 'an actual stream resource, ' + . 'or a Psr\Http\Message\StreamInterface implementation' + ); + } + + return new Stream($stream, $modeIfNotInstance); + } + + /** + * Filter a set of headers to ensure they are in the correct internal format. + * + * Used by message constructors to allow setting all initial headers at once. + * + * @param array $originalHeaders Headers to filter. + */ + private function setHeaders(array $originalHeaders) : void + { + $headerNames = $headers = []; + + foreach ($originalHeaders as $header => $value) { + $value = $this->filterHeaderValue($value); + + $this->assertHeader($header); + + $headerNames[strtolower($header)] = $header; + $headers[$header] = $value; + } + + $this->headerNames = $headerNames; + $this->headers = $headers; + } + + /** + * Validate the HTTP protocol version + * + * @param string $version + * @throws Exception\InvalidArgumentException on invalid HTTP protocol version + */ + private function validateProtocolVersion($version) : void + { + if (empty($version)) { + throw new Exception\InvalidArgumentException( + 'HTTP protocol version can not be empty' + ); + } + 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)) + )); + } + + // HTTP/1 uses a "." numbering scheme to indicate + // versions of the protocol, while HTTP/2 does not. + if (! preg_match('#^(1\.[01]|2)$#', $version)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unsupported HTTP protocol version "%s" provided', + $version + )); + } + } + + /** + * @param mixed $values + * @return string[] + */ + private function filterHeaderValue($values) : array + { + if (! is_array($values)) { + $values = [$values]; + } + + if ([] === $values) { + throw new Exception\InvalidArgumentException( + 'Invalid header value: must be a string or array of strings; ' + . 'cannot be an empty array' + ); + } + + return array_map(function ($value) { + HeaderSecurity::assertValid($value); + + return (string) $value; + }, array_values($values)); + } + + /** + * Ensure header name and values are valid. + * + * @param string $name + * + * @throws Exception\InvalidArgumentException + */ + private function assertHeader($name) : void + { + HeaderSecurity::assertValidName($name); + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Module.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Module.php new file mode 100644 index 0000000000..5d4df5fc0d --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Module.php @@ -0,0 +1,21 @@ + (new ConfigProvider())->getDependencies(), + ]; + } +} 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 new file mode 100644 index 0000000000..b7314db431 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/PhpInputStream.php @@ -0,0 +1,94 @@ +reachedEof) { + return $this->cache; + } + + $this->getContents(); + return $this->cache; + } + + /** + * {@inheritdoc} + */ + public function isWritable() : bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function read($length) : string + { + $content = parent::read($length); + if (! $this->reachedEof) { + $this->cache .= $content; + } + + if ($this->eof()) { + $this->reachedEof = true; + } + + return $content; + } + + /** + * {@inheritdoc} + */ + public function getContents($maxLength = -1) : string + { + if ($this->reachedEof) { + return $this->cache; + } + + $contents = stream_get_contents($this->resource, $maxLength); + $this->cache .= $contents; + + if ($maxLength === -1 || $this->eof()) { + $this->reachedEof = true; + } + + return $contents; + } +} 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 new file mode 100644 index 0000000000..b86b985298 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RelativeStream.php @@ -0,0 +1,183 @@ +decoratedStream = $decoratedStream; + $this->offset = (int) $offset; + } + + /** + * {@inheritdoc} + */ + public function __toString() : string + { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } + + /** + * {@inheritdoc} + */ + public function close() : void + { + $this->decoratedStream->close(); + } + + /** + * {@inheritdoc} + */ + public function detach() + { + return $this->decoratedStream->detach(); + } + + /** + * {@inheritdoc} + */ + public function getSize() : int + { + return $this->decoratedStream->getSize() - $this->offset; + } + + /** + * {@inheritdoc} + */ + public function tell() : int + { + return $this->decoratedStream->tell() - $this->offset; + } + + /** + * {@inheritdoc} + */ + public function eof() : bool + { + return $this->decoratedStream->eof(); + } + + /** + * {@inheritdoc} + */ + public function isSeekable() : bool + { + return $this->decoratedStream->isSeekable(); + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) : void + { + if ($whence == SEEK_SET) { + $this->decoratedStream->seek($offset + $this->offset, $whence); + return; + } + $this->decoratedStream->seek($offset, $whence); + } + + /** + * {@inheritdoc} + */ + public function rewind() : void + { + $this->seek(0); + } + + /** + * {@inheritdoc} + */ + public function isWritable() : bool + { + return $this->decoratedStream->isWritable(); + } + + /** + * {@inheritdoc} + */ + public function write($string) : int + { + if ($this->tell() < 0) { + throw new Exception\InvalidStreamPointerPositionException(); + } + return $this->decoratedStream->write($string); + } + + /** + * {@inheritdoc} + */ + public function isReadable() : bool + { + return $this->decoratedStream->isReadable(); + } + + /** + * {@inheritdoc} + */ + public function read($length) : string + { + if ($this->tell() < 0) { + throw new Exception\InvalidStreamPointerPositionException(); + } + return $this->decoratedStream->read($length); + } + + /** + * {@inheritdoc} + */ + public function getContents() : string + { + if ($this->tell() < 0) { + throw new Exception\InvalidStreamPointerPositionException(); + } + return $this->decoratedStream->getContents(); + } + + /** + * {@inheritdoc} + */ + public function getMetadata($key = null) + { + return $this->decoratedStream->getMetadata($key); + } +} 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 new file mode 100644 index 0000000000..30eabf4060 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request.php @@ -0,0 +1,76 @@ +initialize($uri, $method, $body, $headers); + } + + /** + * {@inheritdoc} + */ + public function getHeaders() : array + { + $headers = $this->headers; + if (! $this->hasHeader('host') + && $this->uri->getHost() + ) { + $headers['Host'] = [$this->getHostFromUri()]; + } + + return $headers; + } + + /** + * {@inheritdoc} + */ + public function getHeader($header) : array + { + if (! $this->hasHeader($header)) { + if (strtolower($header) === 'host' + && $this->uri->getHost() + ) { + return [$this->getHostFromUri()]; + } + + return []; + } + + $header = $this->headerNames[strtolower($header)]; + + return $this->headers[$header]; + } +} 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 new file mode 100644 index 0000000000..26cdf38d88 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/ArraySerializer.php @@ -0,0 +1,83 @@ + $request->getMethod(), + 'request_target' => $request->getRequestTarget(), + 'uri' => (string) $request->getUri(), + 'protocol_version' => $request->getProtocolVersion(), + 'headers' => $request->getHeaders(), + 'body' => (string) $request->getBody(), + ]; + } + + /** + * Deserialize a request array to a request instance. + * + * @throws Exception\DeserializationException when cannot deserialize response + */ + public static function fromArray(array $serializedRequest) : Request + { + try { + $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'); + $protocolVersion = self::getValueFromKey($serializedRequest, 'protocol_version'); + + return (new Request($uri, $method, $body, $headers)) + ->withRequestTarget($requestTarget) + ->withProtocolVersion($protocolVersion); + } catch (Throwable $exception) { + throw Exception\DeserializationException::forRequestFromArray($exception); + } + } + + /** + * @return mixed + * @throws Exception\DeserializationException + */ + private static function getValueFromKey(array $data, string $key, string $message = null) + { + if (isset($data[$key])) { + return $data[$key]; + } + if ($message === null) { + $message = sprintf('Missing "%s" key in serialized request', $key); + } + throw new Exception\DeserializationException($message); + } +} 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 new file mode 100644 index 0000000000..30529e4289 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Request/Serializer.php @@ -0,0 +1,142 @@ +write($message); + return self::fromStream($stream); + } + + /** + * 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. + */ + public static function fromStream(StreamInterface $stream) : Request + { + if (! $stream->isReadable() || ! $stream->isSeekable()) { + throw new Exception\InvalidArgumentException('Message stream must be both readable and seekable'); + } + + $stream->rewind(); + + [$method, $requestTarget, $version] = self::getRequestLine($stream); + $uri = self::createUriFromRequestTarget($requestTarget); + + [$headers, $body] = self::splitStream($stream); + + return (new Request($uri, $method, $body, $headers)) + ->withProtocolVersion($version) + ->withRequestTarget($requestTarget); + } + + /** + * Serialize a request message to a 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'; + + if (! empty($headers)) { + $headers = "\r\n" . $headers; + } + if (! empty($body)) { + $headers .= "\r\n\r\n"; + } + + return sprintf( + $format, + $httpMethod, + $request->getRequestTarget(), + $request->getProtocolVersion(), + $headers, + $body + ); + } + + /** + * Retrieve the components of the request line. + * + * Retrieves the first line of the stream and parses it, raising an + * exception if it does not follow specifications; if valid, returns a list + * with the method, target, and version, in that order. + * + * @throws Exception\SerializationException + */ + 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 + )) { + throw Exception\SerializationException::forInvalidRequestLine(); + } + + return [$matches['method'], $matches['target'], $matches['version']]; + } + + /** + * Create and return a Uri instance based on the provided request target. + * + * If the request target is of authority or asterisk form, an empty Uri + * instance is returned; otherwise, the value is used to create and return + * a new Uri instance. + */ + private static function createUriFromRequestTarget(string $requestTarget) : Uri + { + if (preg_match('#^https?://#', $requestTarget)) { + return new Uri($requestTarget); + } + + if (preg_match('#^(\*|[^/])#', $requestTarget)) { + return new Uri(); + } + + 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 new file mode 100644 index 0000000000..1a46dd5922 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/RequestFactory.php @@ -0,0 +1,25 @@ +setMethod($method); + } + + $this->uri = $this->createUri($uri); + $this->stream = $this->getStream($body, 'wb+'); + + $this->setHeaders($headers); + + // per PSR-7: attempt to set the Host header from a provided URI if no + // Host header is provided + if (! $this->hasHeader('Host') && $this->uri->getHost()) { + $this->headerNames['host'] = 'Host'; + $this->headers['Host'] = [$this->getHostFromUri()]; + } + } + + /** + * Create and return a URI instance. + * + * If `$uri` is a already a `UriInterface` instance, returns it. + * + * If `$uri` is a string, passes it to the `Uri` constructor to return an + * instance. + * + * If `$uri is null, creates and returns an empty `Uri` instance. + * + * Otherwise, it raises an exception. + * + * @param null|string|UriInterface $uri + * @throws Exception\InvalidArgumentException + */ + private function createUri($uri) : UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + if (is_string($uri)) { + return new Uri($uri); + } + if ($uri === null) { + return new Uri(); + } + throw new Exception\InvalidArgumentException( + 'Invalid URI provided; must be null, a string, or a Psr\Http\Message\UriInterface instance' + ); + } + + /** + * Retrieves the message's request target. + * + * Retrieves the message's request-target either as it will appear (for + * clients), as it appeared at request (for servers), or as it was + * specified for the instance (see withRequestTarget()). + * + * In most cases, this will be the origin-form of the composed URI, + * unless a value was provided to the concrete implementation (see + * withRequestTarget() below). + * + * If no URI is available, and no request-target has been specifically + * provided, this method MUST return the string "/". + */ + public function getRequestTarget() : string + { + if (null !== $this->requestTarget) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($this->uri->getQuery()) { + $target .= '?' . $this->uri->getQuery(); + } + + if (empty($target)) { + $target = '/'; + } + + return $target; + } + + /** + * Create a new instance with a specific request-target. + * + * If the request needs a non-origin-form request-target — e.g., for + * specifying an absolute-form, authority-form, or asterisk-form — + * this method may be used to create an instance with the specified + * request-target, verbatim. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * changed request target. + * + * @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. + */ + public function withRequestTarget($requestTarget) : RequestInterface + { + if (preg_match('#\s#', $requestTarget)) { + throw new Exception\InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + /** + * Retrieves the HTTP method of the request. + * + * @return string Returns the request method. + */ + public function getMethod() : string + { + return $this->method; + } + + /** + * Return an instance with the provided HTTP method. + * + * While HTTP method names are typically all uppercase characters, HTTP + * method names are case-sensitive and thus implementations SHOULD NOT + * modify the given string. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * changed request method. + * + * @param string $method Case-insensitive method. + * @throws Exception\InvalidArgumentException for invalid HTTP methods. + */ + public function withMethod($method) : RequestInterface + { + $new = clone $this; + $new->setMethod($method); + return $new; + } + + /** + * Retrieves the URI instance. + * + * 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 + { + return $this->uri; + } + + /** + * Returns an instance with the provided URI. + * + * This method will update the Host header of the returned request by + * default if the URI contains a host component. If the URI does not + * contain a host component, any pre-existing Host header will be carried + * over to the returned request. + * + * You can opt-in to preserving the original state of the Host header by + * setting `$preserveHost` to `true`. When `$preserveHost` is set to + * `true`, the returned request will not update the Host header of the + * returned message -- even if the message contains no Host header. This + * means that a call to `getHeader('Host')` on the original request MUST + * equal the return value of a call to `getHeader('Host')` on the returned + * request. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * 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 + { + $new = clone $this; + $new->uri = $uri; + + if ($preserveHost && $this->hasHeader('Host')) { + return $new; + } + + if (! $uri->getHost()) { + return $new; + } + + $host = $uri->getHost(); + if ($uri->getPort()) { + $host .= ':' . $uri->getPort(); + } + + $new->headerNames['host'] = 'Host'; + + // Remove an existing host header if present, regardless of current + // de-normalization of the header name. + // @see https://github.com/zendframework/zend-diactoros/issues/91 + foreach (array_keys($new->headers) as $header) { + if (strtolower($header) === 'host') { + unset($new->headers[$header]); + } + } + + $new->headers['Host'] = [$host]; + + return $new; + } + + /** + * Set and validate the HTTP method + * + * @param string $method + * @throws Exception\InvalidArgumentException on invalid HTTP method. + */ + private function setMethod($method) : void + { + if (! is_string($method)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unsupported HTTP method; must be a string, received %s', + is_object($method) ? get_class($method) : gettype($method) + )); + } + + if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unsupported HTTP method "%s" provided', + $method + )); + } + $this->method = $method; + } + + /** + * Retrieve the host from the URI instance + */ + private function getHostFromUri() : string + { + $host = $this->uri->getHost(); + $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : ''; + return $host; + } +} 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 new file mode 100644 index 0000000000..1c15255776 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response.php @@ -0,0 +1,200 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 103 => 'Early Hints', + // SUCCESS CODES + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-Status', + 208 => 'Already Reported', + 226 => 'IM Used', + // REDIRECTION CODES + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', // Deprecated to 306 => '(Unused)' + 307 => 'Temporary Redirect', + 308 => 'Permanent Redirect', + // CLIENT ERROR + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Payload Too Large', + 414 => 'URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Range Not Satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 421 => 'Misdirected Request', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Too Early', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 444 => 'Connection Closed Without Response', + 451 => 'Unavailable For Legal Reasons', + // SERVER ERROR + 499 => 'Client Closed Request', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + 599 => 'Network Connect Timeout Error', + ]; + + /** + * @var string + */ + private $reasonPhrase; + + /** + * @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. + */ + public function __construct($body = 'php://memory', int $status = 200, array $headers = []) + { + $this->setStatusCode($status); + $this->stream = $this->getStream($body, 'wb+'); + $this->setHeaders($headers); + } + + /** + * {@inheritdoc} + */ + public function getStatusCode() : int + { + return $this->statusCode; + } + + /** + * {@inheritdoc} + */ + public function getReasonPhrase() : string + { + return $this->reasonPhrase; + } + + /** + * {@inheritdoc} + */ + public function withStatus($code, $reasonPhrase = '') : Response + { + $new = clone $this; + $new->setStatusCode($code, $reasonPhrase); + return $new; + } + + /** + * Set a valid status code. + * + * @param int $code + * @param string $reasonPhrase + * @throws Exception\InvalidArgumentException on an invalid status code. + */ + private function setStatusCode($code, $reasonPhrase = '') : void + { + if (! is_numeric($code) + || is_float($code) + || $code < static::MIN_STATUS_CODE_VALUE + || $code > static::MAX_STATUS_CODE_VALUE + ) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid status code "%s"; must be an integer between %d and %d, inclusive', + is_scalar($code) ? $code : gettype($code), + static::MIN_STATUS_CODE_VALUE, + static::MAX_STATUS_CODE_VALUE + )); + } + + if (! is_string($reasonPhrase)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unsupported response reason phrase; must be a string, received %s', + is_object($reasonPhrase) ? get_class($reasonPhrase) : gettype($reasonPhrase) + )); + } + + if ($reasonPhrase === '' && isset($this->phrases[$code])) { + $reasonPhrase = $this->phrases[$code]; + } + + $this->reasonPhrase = $reasonPhrase; + $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 new file mode 100644 index 0000000000..b2a29976e2 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/ArraySerializer.php @@ -0,0 +1,85 @@ + $response->getStatusCode(), + 'reason_phrase' => $response->getReasonPhrase(), + 'protocol_version' => $response->getProtocolVersion(), + 'headers' => $response->getHeaders(), + 'body' => (string) $response->getBody(), + ]; + } + + /** + * Deserialize a response array to a response instance. + * + * @throws Exception\DeserializationException when cannot deserialize response + */ + public static function fromArray(array $serializedResponse) : Response + { + try { + $body = new Stream('php://memory', 'wb+'); + $body->write(self::getValueFromKey($serializedResponse, 'body')); + + $statusCode = self::getValueFromKey($serializedResponse, 'status_code'); + $headers = self::getValueFromKey($serializedResponse, 'headers'); + $protocolVersion = self::getValueFromKey($serializedResponse, 'protocol_version'); + $reasonPhrase = self::getValueFromKey($serializedResponse, 'reason_phrase'); + + return (new Response($body, $statusCode, $headers)) + ->withProtocolVersion($protocolVersion) + ->withStatus($statusCode, $reasonPhrase); + } catch (Throwable $exception) { + throw Exception\DeserializationException::forResponseFromArray($exception); + } + } + + /** + * @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) + { + if (isset($data[$key])) { + return $data[$key]; + } + if ($message === null) { + $message = sprintf('Missing "%s" key in serialized response', $key); + } + throw new Exception\DeserializationException($message); + } +} 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 new file mode 100644 index 0000000000..3dd56596f4 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/EmptyResponse.php @@ -0,0 +1,43 @@ +createBody($html), + $status, + $this->injectContentType('text/html; charset=utf-8', $headers) + ); + } + + /** + * Create the message body. + * + * @param string|StreamInterface $html + * @throws Exception\InvalidArgumentException if $html is neither a string or stream. + */ + private function createBody($html) : StreamInterface + { + if ($html instanceof StreamInterface) { + return $html; + } + + if (! is_string($html)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid content (%s) provided to %s', + (is_object($html) ? get_class($html) : gettype($html)), + __CLASS__ + )); + } + + $body = new Stream('php://temp', 'wb+'); + $body->write($html); + $body->rewind(); + return $body; + } +} 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 new file mode 100644 index 0000000000..920fe9ad7c --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/InjectContentTypeTrait.php @@ -0,0 +1,36 @@ + + * JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES + * + * + * @const int + */ + const DEFAULT_JSON_FLAGS = 79; + + /** + * @var mixed + */ + private $payload; + + /** + * @var int + */ + private $encodingOptions; + + /** + * Create a JSON response with the given data. + * + * Default JSON encoding is performed with the following options, which + * produces RFC4627-compliant JSON, capable of embedding into HTML. + * + * - JSON_HEX_TAG + * - JSON_HEX_APOS + * - JSON_HEX_AMP + * - JSON_HEX_QUOT + * - JSON_UNESCAPED_SLASHES + * + * @param mixed $data Data to convert to JSON. + * @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. + */ + public function __construct( + $data, + int $status = 200, + array $headers = [], + int $encodingOptions = self::DEFAULT_JSON_FLAGS + ) { + $this->setPayload($data); + $this->encodingOptions = $encodingOptions; + + $json = $this->jsonEncode($data, $this->encodingOptions); + $body = $this->createBodyFromJson($json); + + $headers = $this->injectContentType('application/json', $headers); + + parent::__construct($body, $status, $headers); + } + + /** + * @return mixed + */ + public function getPayload() + { + return $this->payload; + } + + /** + * @param mixed $data + */ + public function withPayload($data) : JsonResponse + { + $new = clone $this; + $new->setPayload($data); + return $this->updateBodyFor($new); + } + + public function getEncodingOptions() : int + { + return $this->encodingOptions; + } + + public function withEncodingOptions(int $encodingOptions) : JsonResponse + { + $new = clone $this; + $new->encodingOptions = $encodingOptions; + return $this->updateBodyFor($new); + } + + private function createBodyFromJson(string $json) : Stream + { + $body = new Stream('php://temp', 'wb+'); + $body->write($json); + $body->rewind(); + + return $body; + } + + /** + * Encode the provided data to JSON. + * + * @param mixed $data + * @throws Exception\InvalidArgumentException if unable to encode the $data to JSON. + */ + private function jsonEncode($data, int $encodingOptions) : string + { + if (is_resource($data)) { + throw new Exception\InvalidArgumentException('Cannot JSON encode resources'); + } + + // Clear json_last_error() + json_encode(null); + + $json = json_encode($data, $encodingOptions); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unable to encode data to JSON in %s: %s', + __CLASS__, + json_last_error_msg() + )); + } + + return $json; + } + + /** + * @param mixed $data + */ + private function setPayload($data) : void + { + if (is_object($data)) { + $data = clone $data; + } + + $this->payload = $data; + } + + /** + * Update the response body for the given instance. + * + * @param self $toUpdate Instance to update. + * @return JsonResponse Returns a new instance with an updated body. + */ + private function updateBodyFor(JsonResponse $toUpdate) : JsonResponse + { + $json = $this->jsonEncode($toUpdate->payload, $toUpdate->encodingOptions); + $body = $this->createBodyFromJson($json); + return $toUpdate->withBody($body); + } +} 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 new file mode 100644 index 0000000000..eb50a83c5c --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/RedirectResponse.php @@ -0,0 +1,53 @@ +write($message); + return static::fromStream($stream); + } + + /** + * Parse a response from a stream. + * + * @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 + { + if (! $stream->isReadable() || ! $stream->isSeekable()) { + throw new Exception\InvalidArgumentException('Message stream must be both readable and seekable'); + } + + $stream->rewind(); + + [$version, $status, $reasonPhrase] = self::getStatusLine($stream); + [$headers, $body] = self::splitStream($stream); + + return (new Response($body, $status, $headers)) + ->withProtocolVersion($version) + ->withStatus((int) $status, $reasonPhrase); + } + + /** + * Create a string representation of a response. + */ + public static function toString(ResponseInterface $response) : string + { + $reasonPhrase = $response->getReasonPhrase(); + $headers = self::serializeHeaders($response->getHeaders()); + $body = (string) $response->getBody(); + $format = 'HTTP/%s %d%s%s%s'; + + if (! empty($headers)) { + $headers = "\r\n" . $headers; + } + + $headers .= "\r\n\r\n"; + + return sprintf( + $format, + $response->getProtocolVersion(), + $response->getStatusCode(), + ($reasonPhrase ? ' ' . $reasonPhrase : ''), + $headers, + $body + ); + } + + /** + * 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 + */ + 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 + )) { + throw Exception\SerializationException::forInvalidStatusLine(); + } + + return [$matches['version'], (int) $matches['status'], isset($matches['reason']) ? $matches['reason'] : '']; + } +} 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 new file mode 100644 index 0000000000..f72bdbeb6a --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/TextResponse.php @@ -0,0 +1,80 @@ +createBody($text), + $status, + $this->injectContentType('text/plain; charset=utf-8', $headers) + ); + } + + /** + * Create the message body. + * + * @param string|StreamInterface $text + * @throws Exception\InvalidArgumentException if $text is neither a string or stream. + */ + private function createBody($text) : StreamInterface + { + if ($text instanceof StreamInterface) { + return $text; + } + + if (! is_string($text)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid content (%s) provided to %s', + (is_object($text) ? get_class($text) : gettype($text)), + __CLASS__ + )); + } + + $body = new Stream('php://temp', 'wb+'); + $body->write($text); + $body->rewind(); + return $body; + } +} 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 new file mode 100644 index 0000000000..06c71ddb84 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Response/XmlResponse.php @@ -0,0 +1,82 @@ +createBody($xml), + $status, + $this->injectContentType('application/xml; charset=utf-8', $headers) + ); + } + + /** + * Create the message body. + * + * @param string|StreamInterface $xml + * @throws Exception\InvalidArgumentException if $xml is neither a string or stream. + */ + private function createBody($xml) : StreamInterface + { + if ($xml instanceof StreamInterface) { + return $xml; + } + + if (! is_string($xml)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid content (%s) provided to %s', + (is_object($xml) ? get_class($xml) : gettype($xml)), + __CLASS__ + )); + } + + $body = new Stream('php://temp', 'wb+'); + $body->write($xml); + $body->rewind(); + return $body; + } +} 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 new file mode 100644 index 0000000000..3ff3881838 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ResponseFactory.php @@ -0,0 +1,26 @@ +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 new file mode 100644 index 0000000000..11973e0a70 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequest.php @@ -0,0 +1,256 @@ +validateUploadedFiles($uploadedFiles); + + if ($body === 'php://input') { + $body = new PhpInputStream(); + } + + $this->initialize($uri, $method, $body, $headers); + $this->serverParams = $serverParams; + $this->uploadedFiles = $uploadedFiles; + $this->cookieParams = $cookies; + $this->queryParams = $queryParams; + $this->parsedBody = $parsedBody; + $this->protocol = $protocol; + } + + /** + * {@inheritdoc} + */ + public function getServerParams() : array + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles() : array + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + */ + public function withUploadedFiles(array $uploadedFiles) : ServerRequest + { + $this->validateUploadedFiles($uploadedFiles); + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + return $new; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams() : array + { + return $this->cookieParams; + } + + /** + * {@inheritdoc} + */ + public function withCookieParams(array $cookies) : ServerRequest + { + $new = clone $this; + $new->cookieParams = $cookies; + return $new; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams() : array + { + return $this->queryParams; + } + + /** + * {@inheritdoc} + */ + public function withQueryParams(array $query) : ServerRequest + { + $new = clone $this; + $new->queryParams = $query; + return $new; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + */ + public function withParsedBody($data) : ServerRequest + { + if (! is_array($data) && ! is_object($data) && null !== $data) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a null, array, or object argument; received %s', + __METHOD__, + gettype($data) + )); + } + + $new = clone $this; + $new->parsedBody = $data; + return $new; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() : array + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function getAttribute($attribute, $default = null) + { + if (! array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + /** + * {@inheritdoc} + */ + public function withAttribute($attribute, $value) : ServerRequest + { + $new = clone $this; + $new->attributes[$attribute] = $value; + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutAttribute($attribute) : ServerRequest + { + $new = clone $this; + unset($new->attributes[$attribute]); + return $new; + } + + /** + * Recursively validate the structure in an uploaded files array. + * + * @throws Exception\InvalidArgumentException if any leaf is not an UploadedFileInterface instance. + */ + private function validateUploadedFiles(array $uploadedFiles) : void + { + foreach ($uploadedFiles as $file) { + if (is_array($file)) { + $this->validateUploadedFiles($file); + continue; + } + + if (! $file instanceof UploadedFileInterface) { + throw new Exception\InvalidArgumentException('Invalid leaf in uploaded files structure'); + } + } + } +} 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 new file mode 100644 index 0000000000..9261ae8022 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/ServerRequestFactory.php @@ -0,0 +1,100 @@ +setStream($stream, $mode); + } + + /** + * {@inheritdoc} + */ + public function __toString() : string + { + if (! $this->isReadable()) { + return ''; + } + + try { + if ($this->isSeekable()) { + $this->rewind(); + } + + return $this->getContents(); + } catch (RuntimeException $e) { + return ''; + } + } + + /** + * {@inheritdoc} + */ + public function close() : void + { + if (! $this->resource) { + return; + } + + $resource = $this->detach(); + fclose($resource); + } + + /** + * {@inheritdoc} + */ + public function detach() + { + $resource = $this->resource; + $this->resource = null; + return $resource; + } + + /** + * 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 + */ + public function attach($resource, string $mode = 'r') : void + { + $this->setStream($resource, $mode); + } + + /** + * {@inheritdoc} + */ + public function getSize() : ?int + { + if (null === $this->resource) { + return null; + } + + $stats = fstat($this->resource); + if ($stats !== false) { + return $stats['size']; + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function tell() : int + { + if (! $this->resource) { + throw Exception\UntellableStreamException::dueToMissingResource(); + } + + $result = ftell($this->resource); + if (! is_int($result)) { + throw Exception\UntellableStreamException::dueToPhpError(); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function eof() : bool + { + if (! $this->resource) { + return true; + } + + return feof($this->resource); + } + + /** + * {@inheritdoc} + */ + public function isSeekable() : bool + { + if (! $this->resource) { + return false; + } + + $meta = stream_get_meta_data($this->resource); + return $meta['seekable']; + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) : void + { + if (! $this->resource) { + throw Exception\UnseekableStreamException::dueToMissingResource(); + } + + if (! $this->isSeekable()) { + throw Exception\UnseekableStreamException::dueToConfiguration(); + } + + $result = fseek($this->resource, $offset, $whence); + + if (0 !== $result) { + throw Exception\UnseekableStreamException::dueToPhpError(); + } + } + + /** + * {@inheritdoc} + */ + public function rewind() : void + { + $this->seek(0); + } + + /** + * {@inheritdoc} + */ + public function isWritable() : bool + { + if (! $this->resource) { + return false; + } + + $meta = stream_get_meta_data($this->resource); + $mode = $meta['mode']; + + return ( + strstr($mode, 'x') + || strstr($mode, 'w') + || strstr($mode, 'c') + || strstr($mode, 'a') + || strstr($mode, '+') + ); + } + + /** + * {@inheritdoc} + */ + public function write($string) : int + { + if (! $this->resource) { + throw Exception\UnwritableStreamException::dueToMissingResource(); + } + + if (! $this->isWritable()) { + throw Exception\UnwritableStreamException::dueToConfiguration(); + } + + $result = fwrite($this->resource, $string); + + if (false === $result) { + throw Exception\UnwritableStreamException::dueToPhpError(); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function isReadable() : bool + { + if (! $this->resource) { + return false; + } + + $meta = stream_get_meta_data($this->resource); + $mode = $meta['mode']; + + return (strstr($mode, 'r') || strstr($mode, '+')); + } + + /** + * {@inheritdoc} + */ + public function read($length) : string + { + if (! $this->resource) { + throw Exception\UnreadableStreamException::dueToMissingResource(); + } + + if (! $this->isReadable()) { + throw Exception\UnreadableStreamException::dueToConfiguration(); + } + + $result = fread($this->resource, $length); + + if (false === $result) { + throw Exception\UnreadableStreamException::dueToPhpError(); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function getContents() : string + { + if (! $this->isReadable()) { + throw Exception\UnreadableStreamException::dueToConfiguration(); + } + + $result = stream_get_contents($this->resource); + if (false === $result) { + throw Exception\UnreadableStreamException::dueToPhpError(); + } + return $result; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($key = null) + { + if (null === $key) { + return stream_get_meta_data($this->resource); + } + + $metadata = stream_get_meta_data($this->resource); + if (! array_key_exists($key, $metadata)) { + return null; + } + + return $metadata[$key]; + } + + /** + * Set the internal stream resource. + * + * @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. + */ + 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\InvalidArgumentException('Invalid stream reference provided'); + } + + if (! $this->isValidStreamResourceType($resource)) { + throw new Exception\InvalidArgumentException( + 'Invalid stream provided; must be a string stream identifier or stream resource' + ); + } + + if ($stream !== $resource) { + $this->stream = $stream; + } + + $this->resource = $resource; + } + + /** + * Determine if a resource is one of the resource types allowed to instantiate a Stream + * + * @param resource $resource Stream resource. + */ + private function isValidStreamResourceType($resource): bool + { + return ( + is_resource($resource) && + in_array(get_resource_type($resource), self::ALLOWED_STREAM_RESOURCE_TYPES, 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 new file mode 100644 index 0000000000..a423182e5f --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/StreamFactory.php @@ -0,0 +1,51 @@ +createStreamFromResource($resource); + } + + /** + * {@inheritDoc} + */ + public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface + { + return new Stream($file, $mode); + } + + /** + * {@inheritDoc} + */ + 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 new file mode 100644 index 0000000000..e1a579fed0 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFile.php @@ -0,0 +1,268 @@ + 'There is no error, the file uploaded with success', + UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', + UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was ' + . 'specified in the HTML form', + UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded', + UPLOAD_ERR_NO_FILE => 'No file was uploaded', + UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', + UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', + UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload.', + ]; + + /** + * @var string|null + */ + private $clientFilename; + + /** + * @var string|null + */ + private $clientMediaType; + + /** + * @var int + */ + private $error; + + /** + * @var null|string + */ + private $file; + + /** + * @var bool + */ + private $moved = false; + + /** + * @var int + */ + private $size; + + /** + * @var null|StreamInterface + */ + private $stream; + + /** + * @param string|resource $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 + ) { + if ($errorStatus === UPLOAD_ERR_OK) { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } + if (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } + + if (! $this->file && ! $this->stream) { + if (! $streamOrFile instanceof StreamInterface) { + throw new Exception\InvalidArgumentException('Invalid stream or file provided for UploadedFile'); + } + $this->stream = $streamOrFile; + } + } + + $this->size = $size; + + if (0 > $errorStatus || 8 < $errorStatus) { + throw new Exception\InvalidArgumentException( + 'Invalid error status for UploadedFile; must be an UPLOAD_ERR_* constant' + ); + } + $this->error = $errorStatus; + + $this->clientFilename = $clientFilename; + $this->clientMediaType = $clientMediaType; + } + + /** + * {@inheritdoc} + * @throws Exception\UploadedFileAlreadyMovedException if the upload was + * not successful. + */ + public function getStream() : StreamInterface + { + if ($this->error !== UPLOAD_ERR_OK) { + throw Exception\UploadedFileErrorException::dueToStreamUploadError( + self::ERROR_MESSAGES[$this->error] + ); + } + + if ($this->moved) { + throw new Exception\UploadedFileAlreadyMovedException(); + } + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + $this->stream = new Stream($this->file); + return $this->stream; + } + + /** + * {@inheritdoc} + * + * @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 + * move operation, or on the second or subsequent call to the method. + */ + public function moveTo($targetPath) : void + { + if ($this->moved) { + throw new Exception\UploadedFileAlreadyMovedException('Cannot move file; already moved!'); + } + + if ($this->error !== UPLOAD_ERR_OK) { + throw Exception\UploadedFileErrorException::dueToStreamUploadError( + self::ERROR_MESSAGES[$this->error] + ); + } + + if (! is_string($targetPath) || empty($targetPath)) { + throw new Exception\InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + $targetDirectory = dirname($targetPath); + if (! is_dir($targetDirectory) || ! is_writable($targetDirectory)) { + throw Exception\UploadedFileErrorException::dueToUnwritableTarget($targetDirectory); + } + + $sapi = PHP_SAPI; + switch (true) { + case (empty($sapi) || 0 === strpos($sapi, 'cli') || 0 === strpos($sapi, 'phpdbg') || ! $this->file): + // Non-SAPI environment, or no filename present + $this->writeFile($targetPath); + break; + default: + // SAPI environment, with file present + if (false === move_uploaded_file($this->file, $targetPath)) { + throw Exception\UploadedFileErrorException::forUnmovableFile(); + } + break; + } + + $this->moved = true; + } + + /** + * {@inheritdoc} + * + * @return int|null The file size in bytes or null if unknown. + */ + public function getSize() : ?int + { + return $this->size; + } + + /** + * {@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 + { + return $this->error; + } + + /** + * {@inheritdoc} + * + * @return string|null The filename sent by the client or null if none + * was provided. + */ + public function getClientFilename() : ?string + { + return $this->clientFilename; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType() : ?string + { + return $this->clientMediaType; + } + + /** + * Write internal stream to given path + * + * @param string $path + */ + private function writeFile(string $path) : void + { + $handle = fopen($path, 'wb+'); + if (false === $handle) { + throw Exception\UploadedFileErrorException::dueToUnwritablePath(); + } + + $stream = $this->getStream(); + $stream->rewind(); + while (! $stream->eof()) { + fwrite($handle, $stream->read(4096)); + } + + fclose($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 new file mode 100644 index 0000000000..46a7d7c5cd --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UploadedFileFactory.php @@ -0,0 +1,37 @@ +getSize(); + } + + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } +} 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 new file mode 100644 index 0000000000..64e4c844df --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/Uri.php @@ -0,0 +1,698 @@ + 80, + 'https' => 443, + ]; + + /** + * @var string + */ + private $scheme = ''; + + /** + * @var string + */ + private $userInfo = ''; + + /** + * @var string + */ + private $host = ''; + + /** + * @var int + */ + private $port; + + /** + * @var string + */ + private $path = ''; + + /** + * @var string + */ + private $query = ''; + + /** + * @var string + */ + private $fragment = ''; + + /** + * generated uri string cache + * @var string|null + */ + private $uriString; + + public function __construct(string $uri = '') + { + if ('' === $uri) { + return; + } + + $this->parseUri($uri); + } + + /** + * Operations to perform on clone. + * + * Since cloning usually is for purposes of mutation, we reset the + * $uriString property so it will be re-calculated. + */ + public function __clone() + { + $this->uriString = null; + } + + /** + * {@inheritdoc} + */ + public function __toString() : string + { + if (null !== $this->uriString) { + return $this->uriString; + } + + $this->uriString = static::createUriString( + $this->scheme, + $this->getAuthority(), + $this->getPath(), // Absolute URIs should use a "/" for an empty path + $this->query, + $this->fragment + ); + + return $this->uriString; + } + + /** + * {@inheritdoc} + */ + public function getScheme() : string + { + return $this->scheme; + } + + /** + * {@inheritdoc} + */ + public function getAuthority() : string + { + if ('' === $this->host) { + return ''; + } + + $authority = $this->host; + if ('' !== $this->userInfo) { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->isNonStandardPort($this->scheme, $this->host, $this->port)) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + /** + * Retrieve the user-info part of the URI. + * + * This value is percent-encoded, per RFC 3986 Section 3.2.1. + * + * {@inheritdoc} + */ + public function getUserInfo() : string + { + return $this->userInfo; + } + + /** + * {@inheritdoc} + */ + public function getHost() : string + { + return $this->host; + } + + /** + * {@inheritdoc} + */ + public function getPort() : ?int + { + return $this->isNonStandardPort($this->scheme, $this->host, $this->port) + ? $this->port + : null; + } + + /** + * {@inheritdoc} + */ + public function getPath() : string + { + return $this->path; + } + + /** + * {@inheritdoc} + */ + public function getQuery() : string + { + return $this->query; + } + + /** + * {@inheritdoc} + */ + public function getFragment() : string + { + return $this->fragment; + } + + /** + * {@inheritdoc} + */ + public function withScheme($scheme) : UriInterface + { + if (! is_string($scheme)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a string argument; received %s', + __METHOD__, + is_object($scheme) ? get_class($scheme) : gettype($scheme) + )); + } + + $scheme = $this->filterScheme($scheme); + + if ($scheme === $this->scheme) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + + return $new; + } + + /** + * Create and return a new instance containing the provided user credentials. + * + * The value will be percent-encoded in the new instance, but with measures + * taken to prevent double-encoding. + * + * {@inheritdoc} + */ + public function withUserInfo($user, $password = null) : UriInterface + { + if (! is_string($user)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a string user argument; received %s', + __METHOD__, + is_object($user) ? get_class($user) : gettype($user) + )); + } + if (null !== $password && ! is_string($password)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a string or null password argument; received %s', + __METHOD__, + is_object($password) ? get_class($password) : gettype($password) + )); + } + + $info = $this->filterUserInfoPart($user); + if (null !== $password) { + $info .= ':' . $this->filterUserInfoPart($password); + } + + if ($info === $this->userInfo) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withHost($host) : UriInterface + { + if (! is_string($host)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a string argument; received %s', + __METHOD__, + is_object($host) ? get_class($host) : gettype($host) + )); + } + + if ($host === $this->host) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->host = strtolower($host); + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withPort($port) : UriInterface + { + if ($port !== null) { + if (! is_numeric($port) || is_float($port)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid port "%s" specified; must be an integer, an integer string, or null', + is_object($port) ? get_class($port) : gettype($port) + )); + } + + $port = (int) $port; + } + + if ($port === $this->port) { + // Do nothing if no change was made. + return $this; + } + + if ($port !== null && ($port < 1 || $port > 65535)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid port "%d" specified; must be a valid TCP/UDP port', + $port + )); + } + + $new = clone $this; + $new->port = $port; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withPath($path) : UriInterface + { + if (! is_string($path)) { + throw new Exception\InvalidArgumentException( + 'Invalid path provided; must be a string' + ); + } + + if (strpos($path, '?') !== false) { + throw new Exception\InvalidArgumentException( + 'Invalid path provided; must not contain a query string' + ); + } + + if (strpos($path, '#') !== false) { + throw new Exception\InvalidArgumentException( + 'Invalid path provided; must not contain a URI fragment' + ); + } + + $path = $this->filterPath($path); + + if ($path === $this->path) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->path = $path; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withQuery($query) : UriInterface + { + if (! is_string($query)) { + throw new Exception\InvalidArgumentException( + 'Query string must be a string' + ); + } + + if (strpos($query, '#') !== false) { + throw new Exception\InvalidArgumentException( + 'Query string must not include a URI fragment' + ); + } + + $query = $this->filterQuery($query); + + if ($query === $this->query) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withFragment($fragment) : UriInterface + { + if (! is_string($fragment)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a string argument; received %s', + __METHOD__, + is_object($fragment) ? get_class($fragment) : gettype($fragment) + )); + } + + $fragment = $this->filterFragment($fragment); + + if ($fragment === $this->fragment) { + // Do nothing if no change was made. + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Parse a URI into its parts, and set the properties + */ + private function parseUri(string $uri) : void + { + $parts = parse_url($uri); + + if (false === $parts) { + throw new Exception\InvalidArgumentException( + 'The source URI string appears to be malformed' + ); + } + + $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 = isset($parts['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']; + } + } + + /** + * Create a URI string from its various parts + */ + private static function createUriString( + string $scheme, + string $authority, + string $path, + string $query, + string $fragment + ) : string { + $uri = ''; + + if ('' !== $scheme) { + $uri .= sprintf('%s:', $scheme); + } + + if ('' !== $authority) { + $uri .= '//' . $authority; + } + + if ('' !== $path && '/' !== substr($path, 0, 1)) { + $path = '/' . $path; + } + + $uri .= $path; + + + if ('' !== $query) { + $uri .= sprintf('?%s', $query); + } + + if ('' !== $fragment) { + $uri .= sprintf('#%s', $fragment); + } + + return $uri; + } + + /** + * Is a given port non-standard for the current scheme? + */ + private function isNonStandardPort(string $scheme, string $host, ?int $port) : bool + { + if ('' === $scheme) { + return '' === $host || null !== $port; + } + + if ('' === $host || null === $port) { + return false; + } + + return ! isset($this->allowedSchemes[$scheme]) || $port !== $this->allowedSchemes[$scheme]; + } + + /** + * Filters the scheme to ensure it is a valid scheme. + * + * @param string $scheme Scheme name. + * @return string Filtered scheme. + */ + private function filterScheme(string $scheme) : string + { + $scheme = strtolower($scheme); + $scheme = preg_replace('#:(//)?$#', '', $scheme); + + if ('' === $scheme) { + return ''; + } + + if (! isset($this->allowedSchemes[$scheme])) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unsupported scheme "%s"; must be any empty string or in the set (%s)', + $scheme, + implode(', ', array_keys($this->allowedSchemes)) + )); + } + + return $scheme; + } + + /** + * 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 + { + $part = $this->filterInvalidUtf8($part); + + // Note the addition of `%` to initial charset; this allows `|` portion + // to match and thus prevent double-encoding. + return preg_replace_callback( + '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/u', + [$this, 'urlEncodeChar'], + $part + ); + } + + /** + * Filters the path of a URI to ensure it is properly encoded. + */ + private function filterPath(string $path) : string + { + $path = $this->filterInvalidUtf8($path); + + $path = preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . ')(:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u', + [$this, 'urlEncodeChar'], + $path + ); + + if ('' === $path) { + // No path + return $path; + } + + if ($path[0] !== '/') { + // Relative path + return $path; + } + + // Ensure only one leading slash, to prevent XSS attempts. + return '/' . ltrim($path, '/'); + } + + /** + * Encode invalid UTF-8 characters in given string. All other characters are unchanged. + */ + private function filterInvalidUtf8(string $string) : string + { + // check if given string contains only valid UTF-8 characters + if (preg_match('//u', $string)) { + return $string; + } + + $letters = str_split($string); + foreach ($letters as $i => $letter) { + if (! preg_match('//u', $letter)) { + $letters[$i] = $this->urlEncodeChar([$letter]); + } + } + + return implode('', $letters); + } + + /** + * Filter a query string to ensure it is propertly encoded. + * + * Ensures that the values in the query string are properly urlencoded. + */ + private function filterQuery(string $query) : string + { + if ('' !== $query && strpos($query, '?') === 0) { + $query = substr($query, 1); + } + + $parts = explode('&', $query); + foreach ($parts as $index => $part) { + [$key, $value] = $this->splitQueryValue($part); + if ($value === null) { + $parts[$index] = $this->filterQueryOrFragment($key); + continue; + } + $parts[$index] = sprintf( + '%s=%s', + $this->filterQueryOrFragment($key), + $this->filterQueryOrFragment($value) + ); + } + + return implode('&', $parts); + } + + /** + * 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 + { + $data = explode('=', $value, 2); + if (! isset($data[1])) { + $data[] = null; + } + return $data; + } + + /** + * Filter a fragment value to ensure it is properly encoded. + */ + private function filterFragment(string $fragment) : string + { + if ('' !== $fragment && strpos($fragment, '#') === 0) { + $fragment = '%23' . substr($fragment, 1); + } + + return $this->filterQueryOrFragment($fragment); + } + + /** + * Filter a query string key or value, or a fragment. + */ + private function filterQueryOrFragment(string $value) : string + { + $value = $this->filterInvalidUtf8($value); + + return preg_replace_callback( + '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/u', + [$this, 'urlEncodeChar'], + $value + ); + } + + /** + * URL encode a character returned by a regex. + */ + 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 new file mode 100644 index 0000000000..43db125aa7 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/UriFactory.php @@ -0,0 +1,25 @@ + $value) { + if (! is_string($key)) { + continue; + } + + if ($value === '') { + continue; + } + + // Apache prefixes environment variables with REDIRECT_ + // if they are added by rewrite rules + if (strpos($key, 'REDIRECT_') === 0) { + $key = substr($key, 9); + + // We will not overwrite existing variables with the + // prefixed versions, though + if (array_key_exists($key, $server)) { + continue; + } + } + + if (strpos($key, 'HTTP_') === 0) { + $name = strtr(strtolower(substr($key, 5)), '_', '-'); + $headers[$name] = $value; + continue; + } + + if (strpos($key, 'CONTENT_') === 0) { + $name = strtr(strtolower($key), '_', '-'); + $headers[$name] = $value; + continue; + } + } + + return $headers; +} 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 new file mode 100644 index 0000000000..78ad76e521 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_method_from_sapi.legacy.php @@ -0,0 +1,21 @@ +[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { + throw Exception\UnrecognizedProtocolVersionException::forVersion( + (string) $server['SERVER_PROTOCOL'] + ); + } + + return $matches['version']; +} 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 new file mode 100644 index 0000000000..ebe9e3d74f --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/marshal_uri_from_sapi.legacy.php @@ -0,0 +1,21 @@ +withScheme($scheme); + + // Set the host + [$host, $port] = $marshalHostAndPort($headers, $server); + if (! empty($host)) { + $uri = $uri->withHost($host); + if (! empty($port)) { + $uri = $uri->withPort($port); + } + } + + // URI path + $path = $marshalRequestPath($server); + + // Strip query string + $path = explode('?', $path, 2)[0]; + + // URI query + $query = ''; + if (isset($server['QUERY_STRING'])) { + $query = ltrim($server['QUERY_STRING'], '?'); + } + + // URI fragment + $fragment = ''; + if (strpos($path, '#') !== false) { + [$path, $fragment] = explode('#', $path, 2); + } + + return $uri + ->withPath($path) + ->withFragment($fragment) + ->withQuery($query); +} 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 new file mode 100644 index 0000000000..e1e7669816 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/normalize_server.legacy.php @@ -0,0 +1,21 @@ + $value) { + if (is_array($value)) { + // Traverse + $normalized[$key] = $recursiveNormalize( + $tmpNameTree[$key], + $sizeTree[$key], + $errorTree[$key], + $nameTree[$key] ?? null, + $typeTree[$key] ?? null + ); + continue; + } + $normalized[$key] = createUploadedFile([ + 'tmp_name' => $tmpNameTree[$key], + 'size' => $sizeTree[$key], + 'error' => $errorTree[$key], + 'name' => $nameTree[$key] ?? null, + 'type' => $typeTree[$key] ?? null, + ]); + } + return $normalized; + }; + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files (as determined by receiving an array to the + * `tmp_name` key of a `$_FILES` specification) and returns a normalized array + * of UploadedFile instances. + * + * This function normalizes a `$_FILES` array representing a nested set of + * uploaded files as produced by the php-fpm SAPI, CGI SAPI, or mod_php + * SAPI. + * + * @param array $files + * @return UploadedFile[] + */ + $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']) + ) { + throw new Exception\InvalidArgumentException(sprintf( + '$files provided to %s MUST contain each of the keys "tmp_name",' + . ' "size", and "error", with each represented as an array;' + . ' one or more were missing or non-array values', + __FUNCTION__ + )); + } + + return $recursiveNormalize( + $files['tmp_name'], + $files['size'], + $files['error'], + $files['name'] ?? null, + $files['type'] ?? null + ); + }; + + $normalized = []; + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + continue; + } + + if (is_array($value) && isset($value['tmp_name']) && is_array($value['tmp_name'])) { + $normalized[$key] = $normalizeUploadedFileSpecification($value); + continue; + } + + if (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = createUploadedFile($value); + continue; + } + + if (is_array($value)) { + $normalized[$key] = normalizeUploadedFiles($value); + continue; + } + + throw new Exception\InvalidArgumentException('Invalid value in files specification'); + } + return $normalized; +} 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 new file mode 100644 index 0000000000..0094483b78 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-diactoros/src/functions/parse_cookie_header.legacy.php @@ -0,0 +1,21 @@ +[!#$%&\'*+-.0-9A-Z^_`a-z|~]+) + = + (?P"?) + (?P[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*) + (?P=DQUOTE) + (?=\\n?[ \t]*$|;[ ]) + )x', $cookieHeader, $matches, PREG_SET_ORDER); + + $cookies = []; + + foreach ($matches as $match) { + $cookies[$match['name']] = urldecode($match['value']); + } + + return $cookies; +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/FUNDING.yml b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/FUNDING.yml new file mode 100644 index 0000000000..6674aab603 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/FUNDING.yml @@ -0,0 +1 @@ +community_bridge: laminas-project diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/workflows/release-on-milestone-closed.yml b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/workflows/release-on-milestone-closed.yml new file mode 100644 index 0000000000..6066f8b20a --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/.github/workflows/release-on-milestone-closed.yml @@ -0,0 +1,71 @@ +# Alternate workflow example. +# This one is identical to the one in release-on-milestone.yml, with one change: +# the Release step uses the ORGANIZATION_ADMIN_TOKEN instead, to allow it to +# trigger a release workflow event. This is useful if you have other actions +# that intercept that event. + +name: "Automatic Releases" + +on: + milestone: + types: + - "closed" + +jobs: + release: + name: "GIT tag, release & create merge-up PR" + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Release" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:release" + env: + "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create Merge-Up Pull Request" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:create-merge-up-pull-request" + env: + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create and/or Switch to new Release Branch" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor" + env: + "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Bump Changelog Version On Originating Release Branch" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:bump-changelog" + env: + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + + - name: "Create new milestones" + uses: "laminas/automatic-releases@v1" + with: + command-name: "laminas:automatic-releases:create-milestones" + env: + "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} + "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} + "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} + "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/CHANGELOG.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/CHANGELOG.md new file mode 100644 index 0000000000..fee5e07a7f --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/CHANGELOG.md @@ -0,0 +1,686 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.1.1 - 2020-09-14 + +### Fixed + +- [#71](https://github.com/laminas/laminas-zendframework-bridge/pull/71) fixes detection of the vendor directory when the `COMPOSER_VENDOR_DIR` env variable is missing or empty. Previously, this could lead to scenarios where a non-existent path was used for finding the bridge autoloader. + + +----- + +### Release Notes for [1.1.1](https://github.com/laminas/laminas-zendframework-bridge/milestone/5) + + + +### 1.1.1 + +- Total issues resolved: **0** +- Total pull requests resolved: **1** +- Total contributors: **1** + +#### Bug + + - [71: Verify `COMPOSER_VENDOR_DIR` in conditional](https://github.com/laminas/laminas-zendframework-bridge/pull/71) thanks to @aaronbushnell + +## 1.1.0 - 2020-08-18 + +### Added + +- [#68](https://github.com/laminas/laminas-zendframework-bridge/pull/68) adds support for the upcoming PHP 8.0 release. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#67](https://github.com/laminas/laminas-zendframework-bridge/pull/67) fixes how the Composer autoload file is found, looking first in the `COMPOSER_VENDOR_DIR` before trying to resolve relative to where the package is installed. + +## 1.0.4 - 2020-05-20 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#66](https://github.com/laminas/laminas-zendframework-bridge/pull/66) ensures that references to BjyAuthorize templates are not rewritten, so that they can be resolved during runtime. + +## 1.0.3 - 2020-04-03 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#63](https://github.com/laminas/laminas-zendframework-bridge/pull/63) fixes handling of dependency configuration to ensure each of delegators, initializers, and abstract factories are properly handled during configuraiton post processing. The new approach should allow delegators to work post-migration to Laminas or Mezzio. + +- [#61](https://github.com/laminas/laminas-zendframework-bridge/pull/61) ensures configuration for delegator factories gets rewritten; the functionality broke in version 1.0.1. + +## 1.0.2 - 2020-03-26 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#55](https://github.com/laminas/laminas-zendframework-bridge/pull/55) adds provisions to ensure that references to legacy classes/interfaces in dependency configuration always create aliases from the legacy to the new classes. Previously, we did straight replacements in the configuration, which could lead to the legacy service no longer being available. Now it will remain available. + +- [#59](https://github.com/laminas/laminas-zendframework-bridge/pull/59) fixes the replacement rules such as to avoid replacing references to API Skeletons packages, classes, or configuration keys. + +- [#57](https://github.com/laminas/laminas-zendframework-bridge/pull/57) fixes how references to the "zf-apigility" key are replaced. Previously, they were rewritten to "laminas-api-tools", but the correct replacement is "api-tools". + +- [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) provides a mechanism to add additional maps with multiple levels of namespace separator escaping, in order to ensure that all various known permutations are matched. The escaping is applied to both the original and target, to ensure that rewrites conform to the original escaping. + +- [#56](https://github.com/laminas/laminas-zendframework-bridge/pull/56) makes changes to the replacement rules to ensure we do not replace references to "Zend" or "ZF" if they occur as subnamespaces OR as class names (formerly, we only enforced subnamespaces). Additional rules were provided for cases where one or both occur within our own packages. + +- [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes a scenario whereby factory _values_ were not being rewritten during configuration post processing. + +- [#52](https://github.com/laminas/laminas-zendframework-bridge/pull/52) fixes an issue that occurs with the configuration post processor. Previously, when a service name used as a factory or invokable was encountered that referenced a legacy class, it would get rewritten. This would cause issues if the service was not exposed in the original legacy package, however, as there would now be no alias of the legacy service to the new one. This patch modifies the configuration post processor such that it now tests to see if a service name it will rename exists as an alias; if not, it also creates the alias. + +## 1.0.1 - 2020-01-07 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#47](https://github.com/laminas/laminas-zendframework-bridge/pull/47) adds entries for rewriting the various `::*Zend()` methods exposed in the psr7bridge to `::*Laminas()` during migrations. + +- [#46](https://github.com/laminas/laminas-zendframework-bridge/pull/46) adds a rule to rewrite the config key `use_zend_loader` to `use_laminas_loader`. + +- [#45](https://github.com/laminas/laminas-zendframework-bridge/pull/45) adds a rule to exclude rewriting of view paths provided by the various Doctrine modules targeting the developer tools. + +## 1.0.0 - 2019-12-31 + +### Added + +- First stable release. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.4.5 - 2019-12-23 + +### Added + +- Nothing. + +### Changed + +- [#42](https://github.com/laminas/laminas-zendframework-bridge/pull/42) modifies the replacement rules to no longer rewrite zf-deploy; the package will not be coming to the new organizations. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.4.4 - 2019-12-18 + +### Added + +- Nothing. + +### Changed + +- [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusion rules for subnamespaces that reference Zend, ZF, ZendService, or ZendOAuth to ensure they are not rewritten. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#40](https://github.com/laminas/laminas-zendframework-bridge/pull/40) adds exclusions for classes referencing Zend Server product features to ensure they are not rewritten (e.g., `ZendServerDisk`, `ZendServerShm`, `ZendMonitor`). + +## 0.4.3 - 2019-12-17 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#39](https://github.com/laminas/laminas-zendframework-bridge/pull/39) fixes an issue when using the Auryn DI container. The class `Northwoods\Container\Zend\Config` was incorrectly being renamed to `Northwoods\Container\Laminas\Config` (which should not happen, as it is not a class under our control). + +## 0.4.2 - 2019-12-16 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#36](https://github.com/laminas/laminas-zendframework-bridge/pull/36) adds some cases for classes that contain the verbiage "Expressive" and "Apigility" ot ensure they are rewritten correctly. + +## 0.4.1 - 2019-12-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#35](https://github.com/laminas/laminas-zendframework-bridge/pull/35) removes zend-debug from the replacement list, as it is not being brought over to Laminas. + +## 0.4.0 - 2019-11-27 + +### Added + +- Nothing. + +### Changed + +- [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Expressive to instead reference Mezzio. + +- [#32](https://github.com/laminas/laminas-zendframework-bridge/pull/32) changes all references to Apigility to instead reference Laminas API Tools. The vendor becomes laminas-api-tools, the URL becomes api-tools.getlaminas.org, packages and repos are prefixed with api-tools, and namespaces become `Laminas\ApiTools`. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.8 - 2019-11-14 + +### Added + +- [#29](https://github.com/laminas/laminas-zendframework-bridge/pull/29) adds entries to translate `ZendDeveloperTools` to `Laminas\DeveloperTools`, and vice-versa. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.7 - 2019-11-12 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#28](https://github.com/laminas/laminas-zendframework-bridge/pull/28) updates the `zenddevelopertools` string to rewrite to `laminas-developer-tools` instead of `laminasdevelopertools`. + +## 0.3.6 - 2019-11-07 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#27](https://github.com/laminas/laminas-zendframework-bridge/pull/27) adds a rewrite rule for zend-framework.flf => laminas-project.flf. + +## 0.3.5 - 2019-11-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#25](https://github.com/laminas/laminas-zendframework-bridge/pull/25) adds entries for ZendHttp and ZendModule, which are file name segments in files from the zend-feed and zend-config-aggregator-module packages, respectively. + +## 0.3.4 - 2019-11-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#24](https://github.com/laminas/laminas-zendframework-bridge/pull/24) adds a rule to never rewrite the string `Doctrine\Zend`. + +- [#23](https://github.com/laminas/laminas-zendframework-bridge/pull/23) adds a missing map for each of ZendAcl and ZendRbac, which occur in the zend-expressive-authorization-acl and zend-expressive-authorization-rbac packages, respectively. + +## 0.3.3 - 2019-11-06 + +### Added + +- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) adds configuration post-processing features, exposed both as a laminas-config-aggregator post processor (for use with Expressive applications) and as a laminas-modulemanager `EVENT_MERGE_CONFIG` listener (for use with MVC applications). When registered, it will post-process the configuration, replacing known Zend Framework-specific strings with their Laminas replacements. A ruleset is provided that ensures dependency configuration is rewritten in a safe manner, routing configuration is skipped, and certain top-level configuration keys are matched exactly (instead of potentially as substrings or word stems). A later release of laminas-migration will auto-register these tools in applications when possible. + +### Changed + +- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) removes support for PHP versions prior to PHP 5.6. We have decided to only support supported PHP versions, whether that support is via php.net or commercial. The lowest supported PHP version we have found is 5.6. Users wishing to migrate to Laminas must at least update to PHP 5.6 before doing so. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.2 - 2019-10-30 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the Amazon library, as it is not moving to Laminas. + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the GCM and APNS libraries, as they are not moving to Laminas. + +### Fixed + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) fixes how the recaptcha and twitter library package and namespaces are rewritten. + +## 0.3.1 - 2019-04-25 + +### Added + +- [#20](https://github.com/laminas/laminas-zendframework-bridge/pull/20) provides an additional autoloader that is _prepended_ to the autoloader + stack. This new autoloader will create class aliases for interfaces, classes, + and traits referenced in type hints and class declarations, ensuring PHP is + able to resolve them correctly during class_alias operations. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.0 - 2019-04-12 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) removes the `RewriteRules::classRewrite()` method, as it is no longer + needed due to internal refactoring. + +### Fixed + +- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) fixes how the rewrite rules detect the word `Zend` in subnamespaces and + class names to be both more robust and simpler. + +## 0.2.5 - 2019-04-11 + +### Added + +- [#12](https://github.com/laminas/laminas-zendframework-bridge/pull/12) adds functionality for ensuring we alias namespaces and classes that + include the word `Zend` in them; e.g., `Zend\Expressive\ZendView\ZendViewRendererFactory` + will now alias to `Expressive\LaminasView\LaminasViewRendererFactory`. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.2.4 - 2019-04-11 + +### Added + +- [#11](https://github.com/laminas/laminas-zendframework-bridge/pull/11) adds maps for the Expressive router adapter packages. + +- [#10](https://github.com/laminas/laminas-zendframework-bridge/pull/10) adds a map for the Psr7Bridge package, as it used `Zend` within a subnamespace. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.2.3 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#9](https://github.com/laminas/laminas-zendframework-bridge/pull/9) fixes the mapping for the Problem Details package. + +## 0.2.2 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Added a check that the discovered alias exists as a class, interface, or trait + before attempting to call `class_alias()`. + +## 0.2.1 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#8](https://github.com/laminas/laminas-zendframework-bridge/pull/8) fixes mappings for each of zend-expressive-authentication-zendauthentication, + zend-expressive-zendrouter, and zend-expressive-zendviewrenderer. + +## 0.2.0 - 2019-04-01 + +### Added + +- Nothing. + +### Changed + +- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) rewrites the autoloader to be class-based, via the class + `Laminas\ZendFrameworkBridge\Autoloader`. Additionally, the new approach + provides a performance boost by using a balanced tree algorithm, ensuring + matches occur faster. + +### Deprecated + +- Nothing. + +### Removed + +- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) removes function aliasing. Function aliasing will move to the packages that + provide functions. + +### Fixed + +- Nothing. + +## 0.1.0 - 2019-03-27 + +### Added + +- Adds an autoloader file that registers with `spl_autoload_register` a routine + for aliasing legacy ZF class/interface/trait names to Laminas Project + equivalents. + +- Adds autoloader files for aliasing legacy ZF package functions to Laminas + Project equivalents. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/COPYRIGHT.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/COPYRIGHT.md new file mode 100644 index 0000000000..0a8cccc06b --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/COPYRIGHT.md @@ -0,0 +1 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/LICENSE.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/LICENSE.md new file mode 100644 index 0000000000..10b40f1423 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/README.md b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/README.md new file mode 100644 index 0000000000..fd7953823b --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/README.md @@ -0,0 +1,24 @@ +# laminas-zendframework-bridge + +[![Build Status](https://travis-ci.com/laminas/laminas-zendframework-bridge.svg?branch=master)](https://travis-ci.com/laminas/laminas-zendframework-bridge) +[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-zendframework-bridge/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-zendframework-bridge?branch=master) + +This library provides a custom autoloader that aliases legacy Zend Framework, +Apigility, and Expressive classes to their replacements under the Laminas +Project. + +This package should be installed only if you are also using the composer plugin +that installs Laminas packages to replace ZF/Apigility/Expressive packages. + +## Installation + +Run the following to install this library: + +```bash +$ composer require laminas/laminas-zendframework-bridge +``` + +## Support + +* [Issues](https://github.com/laminas/laminas-zendframework-bridge/issues/) +* [Forum](https://discourse.laminas.dev/) diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/composer.json b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/composer.json new file mode 100644 index 0000000000..34af15a43a --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/composer.json @@ -0,0 +1,58 @@ +{ + "name": "laminas/laminas-zendframework-bridge", + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "license": "BSD-3-Clause", + "keywords": [ + "autoloading", + "laminas", + "zf", + "zendframework" + ], + "support": { + "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", + "source": "https://github.com/laminas/laminas-zendframework-bridge", + "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", + "forum": "https://discourse.laminas.dev/" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "autoload-dev": { + "files": [ + "test/classes.php" + ], + "psr-4": { + "LaminasTest\\ZendFrameworkBridge\\": "test/", + "LaminasTest\\ZendFrameworkBridge\\TestAsset\\": "test/TestAsset/classes/", + "Laminas\\ApiTools\\": "test/TestAsset/LaminasApiTools/", + "Mezzio\\": "test/TestAsset/Mezzio/", + "Laminas\\": "test/TestAsset/Laminas/" + } + }, + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/config/replacements.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/config/replacements.php new file mode 100644 index 0000000000..f5344355f1 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/config/replacements.php @@ -0,0 +1,372 @@ + 'zendframework/zendframework', + 'zend-developer-tools/toolbar/bjy' => 'zend-developer-tools/toolbar/bjy', + 'zend-developer-tools/toolbar/doctrine' => 'zend-developer-tools/toolbar/doctrine', + + // NAMESPACES + // Zend Framework components + 'Zend\\AuraDi\\Config' => 'Laminas\\AuraDi\\Config', + 'Zend\\Authentication' => 'Laminas\\Authentication', + 'Zend\\Barcode' => 'Laminas\\Barcode', + 'Zend\\Cache' => 'Laminas\\Cache', + 'Zend\\Captcha' => 'Laminas\\Captcha', + 'Zend\\Code' => 'Laminas\\Code', + 'ZendCodingStandard\\Sniffs' => 'LaminasCodingStandard\\Sniffs', + 'ZendCodingStandard\\Utils' => 'LaminasCodingStandard\\Utils', + 'Zend\\ComponentInstaller' => 'Laminas\\ComponentInstaller', + 'Zend\\Config' => 'Laminas\\Config', + 'Zend\\ConfigAggregator' => 'Laminas\\ConfigAggregator', + 'Zend\\ConfigAggregatorModuleManager' => 'Laminas\\ConfigAggregatorModuleManager', + 'Zend\\ConfigAggregatorParameters' => 'Laminas\\ConfigAggregatorParameters', + 'Zend\\Console' => 'Laminas\\Console', + 'Zend\\ContainerConfigTest' => 'Laminas\\ContainerConfigTest', + 'Zend\\Crypt' => 'Laminas\\Crypt', + 'Zend\\Db' => 'Laminas\\Db', + 'ZendDeveloperTools' => 'Laminas\\DeveloperTools', + 'Zend\\Di' => 'Laminas\\Di', + 'Zend\\Diactoros' => 'Laminas\\Diactoros', + 'ZendDiagnostics\\Check' => 'Laminas\\Diagnostics\\Check', + 'ZendDiagnostics\\Result' => 'Laminas\\Diagnostics\\Result', + 'ZendDiagnostics\\Runner' => 'Laminas\\Diagnostics\\Runner', + 'Zend\\Dom' => 'Laminas\\Dom', + 'Zend\\Escaper' => 'Laminas\\Escaper', + 'Zend\\EventManager' => 'Laminas\\EventManager', + 'Zend\\Feed' => 'Laminas\\Feed', + 'Zend\\File' => 'Laminas\\File', + 'Zend\\Filter' => 'Laminas\\Filter', + 'Zend\\Form' => 'Laminas\\Form', + 'Zend\\Http' => 'Laminas\\Http', + 'Zend\\HttpHandlerRunner' => 'Laminas\\HttpHandlerRunner', + 'Zend\\Hydrator' => 'Laminas\\Hydrator', + 'Zend\\I18n' => 'Laminas\\I18n', + 'Zend\\InputFilter' => 'Laminas\\InputFilter', + 'Zend\\Json' => 'Laminas\\Json', + 'Zend\\Ldap' => 'Laminas\\Ldap', + 'Zend\\Loader' => 'Laminas\\Loader', + 'Zend\\Log' => 'Laminas\\Log', + 'Zend\\Mail' => 'Laminas\\Mail', + 'Zend\\Math' => 'Laminas\\Math', + 'Zend\\Memory' => 'Laminas\\Memory', + 'Zend\\Mime' => 'Laminas\\Mime', + 'Zend\\ModuleManager' => 'Laminas\\ModuleManager', + 'Zend\\Mvc' => 'Laminas\\Mvc', + 'Zend\\Navigation' => 'Laminas\\Navigation', + 'Zend\\Paginator' => 'Laminas\\Paginator', + 'Zend\\Permissions' => 'Laminas\\Permissions', + 'Zend\\Pimple\\Config' => 'Laminas\\Pimple\\Config', + 'Zend\\ProblemDetails' => 'Mezzio\\ProblemDetails', + 'Zend\\ProgressBar' => 'Laminas\\ProgressBar', + 'Zend\\Psr7Bridge' => 'Laminas\\Psr7Bridge', + 'Zend\\Router' => 'Laminas\\Router', + 'Zend\\Serializer' => 'Laminas\\Serializer', + 'Zend\\Server' => 'Laminas\\Server', + 'Zend\\ServiceManager' => 'Laminas\\ServiceManager', + 'ZendService\\ReCaptcha' => 'Laminas\\ReCaptcha', + 'ZendService\\Twitter' => 'Laminas\\Twitter', + 'Zend\\Session' => 'Laminas\\Session', + 'Zend\\SkeletonInstaller' => 'Laminas\\SkeletonInstaller', + 'Zend\\Soap' => 'Laminas\\Soap', + 'Zend\\Stdlib' => 'Laminas\\Stdlib', + 'Zend\\Stratigility' => 'Laminas\\Stratigility', + 'Zend\\Tag' => 'Laminas\\Tag', + 'Zend\\Test' => 'Laminas\\Test', + 'Zend\\Text' => 'Laminas\\Text', + 'Zend\\Uri' => 'Laminas\\Uri', + 'Zend\\Validator' => 'Laminas\\Validator', + 'Zend\\View' => 'Laminas\\View', + 'ZendXml' => 'Laminas\\Xml', + 'Zend\\Xml2Json' => 'Laminas\\Xml2Json', + 'Zend\\XmlRpc' => 'Laminas\\XmlRpc', + 'ZendOAuth' => 'Laminas\\OAuth', + + // class ZendAcl in zend-expressive-authorization-acl + 'ZendAcl' => 'LaminasAcl', + 'Zend\\Expressive\\Authorization\\Acl\\ZendAcl' => 'Mezzio\\Authorization\\Acl\\LaminasAcl', + // class ZendHttpClientDecorator in zend-feed + 'ZendHttp' => 'LaminasHttp', + // class ZendModuleProvider in zend-config-aggregator-modulemanager + 'ZendModule' => 'LaminasModule', + // class ZendRbac in zend-expressive-authorization-rbac + 'ZendRbac' => 'LaminasRbac', + 'Zend\\Expressive\\Authorization\\Rbac\\ZendRbac' => 'Mezzio\\Authorization\\Rbac\\LaminasRbac', + // class ZendRouter in zend-expressive-router-zendrouter + 'ZendRouter' => 'LaminasRouter', + 'Zend\\Expressive\\Router\\ZendRouter' => 'Mezzio\\Router\\LaminasRouter', + // class ZendViewRenderer in zend-expressive-zendviewrenderer + 'ZendViewRenderer' => 'LaminasViewRenderer', + 'Zend\\Expressive\\ZendView\\ZendViewRenderer' => 'Mezzio\\LaminasView\\LaminasViewRenderer', + 'a\\Zend' => 'a\\Zend', + 'b\\Zend' => 'b\\Zend', + 'c\\Zend' => 'c\\Zend', + 'd\\Zend' => 'd\\Zend', + 'e\\Zend' => 'e\\Zend', + 'f\\Zend' => 'f\\Zend', + 'g\\Zend' => 'g\\Zend', + 'h\\Zend' => 'h\\Zend', + 'i\\Zend' => 'i\\Zend', + 'j\\Zend' => 'j\\Zend', + 'k\\Zend' => 'k\\Zend', + 'l\\Zend' => 'l\\Zend', + 'm\\Zend' => 'm\\Zend', + 'n\\Zend' => 'n\\Zend', + 'o\\Zend' => 'o\\Zend', + 'p\\Zend' => 'p\\Zend', + 'q\\Zend' => 'q\\Zend', + 'r\\Zend' => 'r\\Zend', + 's\\Zend' => 's\\Zend', + 't\\Zend' => 't\\Zend', + 'u\\Zend' => 'u\\Zend', + 'v\\Zend' => 'v\\Zend', + 'w\\Zend' => 'w\\Zend', + 'x\\Zend' => 'x\\Zend', + 'y\\Zend' => 'y\\Zend', + 'z\\Zend' => 'z\\Zend', + + // Expressive + 'Zend\\Expressive' => 'Mezzio', + 'ZendAuthentication' => 'LaminasAuthentication', + 'ZendAcl' => 'LaminasAcl', + 'ZendRbac' => 'LaminasRbac', + 'ZendRouter' => 'LaminasRouter', + 'ExpressiveUrlGenerator' => 'MezzioUrlGenerator', + 'ExpressiveInstaller' => 'MezzioInstaller', + + // Apigility + 'ZF\\Apigility' => 'Laminas\\ApiTools', + 'ZF\\ApiProblem' => 'Laminas\\ApiTools\\ApiProblem', + 'ZF\\AssetManager' => 'Laminas\\ApiTools\\AssetManager', + 'ZF\\ComposerAutoloading' => 'Laminas\\ComposerAutoloading', + 'ZF\\Configuration' => 'Laminas\\ApiTools\\Configuration', + 'ZF\\ContentNegotiation' => 'Laminas\\ApiTools\\ContentNegotiation', + 'ZF\\ContentValidation' => 'Laminas\\ApiTools\\ContentValidation', + 'ZF\\DevelopmentMode' => 'Laminas\\DevelopmentMode', + 'ZF\\Doctrine\\QueryBuilder' => 'Laminas\\ApiTools\\Doctrine\\QueryBuilder', + 'ZF\\Hal' => 'Laminas\\ApiTools\\Hal', + 'ZF\\HttpCache' => 'Laminas\\ApiTools\\HttpCache', + 'ZF\\MvcAuth' => 'Laminas\\ApiTools\\MvcAuth', + 'ZF\\OAuth2' => 'Laminas\\ApiTools\\OAuth2', + 'ZF\\Rest' => 'Laminas\\ApiTools\\Rest', + 'ZF\\Rpc' => 'Laminas\\ApiTools\\Rpc', + 'ZF\\Versioning' => 'Laminas\\ApiTools\\Versioning', + 'a\\ZF' => 'a\\ZF', + 'b\\ZF' => 'b\\ZF', + 'c\\ZF' => 'c\\ZF', + 'd\\ZF' => 'd\\ZF', + 'e\\ZF' => 'e\\ZF', + 'f\\ZF' => 'f\\ZF', + 'g\\ZF' => 'g\\ZF', + 'h\\ZF' => 'h\\ZF', + 'i\\ZF' => 'i\\ZF', + 'j\\ZF' => 'j\\ZF', + 'k\\ZF' => 'k\\ZF', + 'l\\ZF' => 'l\\ZF', + 'm\\ZF' => 'm\\ZF', + 'n\\ZF' => 'n\\ZF', + 'o\\ZF' => 'o\\ZF', + 'p\\ZF' => 'p\\ZF', + 'q\\ZF' => 'q\\ZF', + 'r\\ZF' => 'r\\ZF', + 's\\ZF' => 's\\ZF', + 't\\ZF' => 't\\ZF', + 'u\\ZF' => 'u\\ZF', + 'v\\ZF' => 'v\\ZF', + 'w\\ZF' => 'w\\ZF', + 'x\\ZF' => 'x\\ZF', + 'y\\ZF' => 'y\\ZF', + 'z\\ZF' => 'z\\ZF', + + 'ApigilityModuleInterface' => 'ApiToolsModuleInterface', + 'ApigilityProviderInterface' => 'ApiToolsProviderInterface', + 'ApigilityVersionController' => 'ApiToolsVersionController', + + // PACKAGES + // ZF components, MVC + 'zendframework/skeleton-application' => 'laminas/skeleton-application', + 'zendframework/zend-auradi-config' => 'laminas/laminas-auradi-config', + 'zendframework/zend-authentication' => 'laminas/laminas-authentication', + 'zendframework/zend-barcode' => 'laminas/laminas-barcode', + 'zendframework/zend-cache' => 'laminas/laminas-cache', + 'zendframework/zend-captcha' => 'laminas/laminas-captcha', + 'zendframework/zend-code' => 'laminas/laminas-code', + 'zendframework/zend-coding-standard' => 'laminas/laminas-coding-standard', + 'zendframework/zend-component-installer' => 'laminas/laminas-component-installer', + 'zendframework/zend-composer-autoloading' => 'laminas/laminas-composer-autoloading', + 'zendframework/zend-config-aggregator' => 'laminas/laminas-config-aggregator', + 'zendframework/zend-config' => 'laminas/laminas-config', + 'zendframework/zend-console' => 'laminas/laminas-console', + 'zendframework/zend-container-config-test' => 'laminas/laminas-container-config-test', + 'zendframework/zend-crypt' => 'laminas/laminas-crypt', + 'zendframework/zend-db' => 'laminas/laminas-db', + 'zendframework/zend-developer-tools' => 'laminas/laminas-developer-tools', + 'zendframework/zend-diactoros' => 'laminas/laminas-diactoros', + 'zendframework/zenddiagnostics' => 'laminas/laminas-diagnostics', + 'zendframework/zend-di' => 'laminas/laminas-di', + 'zendframework/zend-dom' => 'laminas/laminas-dom', + 'zendframework/zend-escaper' => 'laminas/laminas-escaper', + 'zendframework/zend-eventmanager' => 'laminas/laminas-eventmanager', + 'zendframework/zend-feed' => 'laminas/laminas-feed', + 'zendframework/zend-file' => 'laminas/laminas-file', + 'zendframework/zend-filter' => 'laminas/laminas-filter', + 'zendframework/zend-form' => 'laminas/laminas-form', + 'zendframework/zend-httphandlerrunner' => 'laminas/laminas-httphandlerrunner', + 'zendframework/zend-http' => 'laminas/laminas-http', + 'zendframework/zend-hydrator' => 'laminas/laminas-hydrator', + 'zendframework/zend-i18n' => 'laminas/laminas-i18n', + 'zendframework/zend-i18n-resources' => 'laminas/laminas-i18n-resources', + 'zendframework/zend-inputfilter' => 'laminas/laminas-inputfilter', + 'zendframework/zend-json' => 'laminas/laminas-json', + 'zendframework/zend-json-server' => 'laminas/laminas-json-server', + 'zendframework/zend-ldap' => 'laminas/laminas-ldap', + 'zendframework/zend-loader' => 'laminas/laminas-loader', + 'zendframework/zend-log' => 'laminas/laminas-log', + 'zendframework/zend-mail' => 'laminas/laminas-mail', + 'zendframework/zend-math' => 'laminas/laminas-math', + 'zendframework/zend-memory' => 'laminas/laminas-memory', + 'zendframework/zend-mime' => 'laminas/laminas-mime', + 'zendframework/zend-modulemanager' => 'laminas/laminas-modulemanager', + 'zendframework/zend-mvc' => 'laminas/laminas-mvc', + 'zendframework/zend-navigation' => 'laminas/laminas-navigation', + 'zendframework/zend-oauth' => 'laminas/laminas-oauth', + 'zendframework/zend-paginator' => 'laminas/laminas-paginator', + 'zendframework/zend-permissions-acl' => 'laminas/laminas-permissions-acl', + 'zendframework/zend-permissions-rbac' => 'laminas/laminas-permissions-rbac', + 'zendframework/zend-pimple-config' => 'laminas/laminas-pimple-config', + 'zendframework/zend-progressbar' => 'laminas/laminas-progressbar', + 'zendframework/zend-psr7bridge' => 'laminas/laminas-psr7bridge', + 'zendframework/zend-recaptcha' => 'laminas/laminas-recaptcha', + 'zendframework/zend-router' => 'laminas/laminas-router', + 'zendframework/zend-serializer' => 'laminas/laminas-serializer', + 'zendframework/zend-server' => 'laminas/laminas-server', + 'zendframework/zend-servicemanager' => 'laminas/laminas-servicemanager', + 'zendframework/zendservice-recaptcha' => 'laminas/laminas-recaptcha', + 'zendframework/zendservice-twitter' => 'laminas/laminas-twitter', + 'zendframework/zend-session' => 'laminas/laminas-session', + 'zendframework/zend-skeleton-installer' => 'laminas/laminas-skeleton-installer', + 'zendframework/zend-soap' => 'laminas/laminas-soap', + 'zendframework/zend-stdlib' => 'laminas/laminas-stdlib', + 'zendframework/zend-stratigility' => 'laminas/laminas-stratigility', + 'zendframework/zend-tag' => 'laminas/laminas-tag', + 'zendframework/zend-test' => 'laminas/laminas-test', + 'zendframework/zend-text' => 'laminas/laminas-text', + 'zendframework/zend-uri' => 'laminas/laminas-uri', + 'zendframework/zend-validator' => 'laminas/laminas-validator', + 'zendframework/zend-view' => 'laminas/laminas-view', + 'zendframework/zend-xml2json' => 'laminas/laminas-xml2json', + 'zendframework/zend-xml' => 'laminas/laminas-xml', + 'zendframework/zend-xmlrpc' => 'laminas/laminas-xmlrpc', + + // Expressive packages + 'zendframework/zend-expressive' => 'mezzio/mezzio', + 'zendframework/zend-expressive-zendrouter' => 'mezzio/mezzio-laminasrouter', + 'zendframework/zend-problem-details' => 'mezzio/mezzio-problem-details', + 'zendframework/zend-expressive-zendviewrenderer' => 'mezzio/mezzio-laminasviewrenderer', + + // Apigility packages + 'zfcampus/apigility-documentation' => 'laminas-api-tools/documentation', + 'zfcampus/statuslib-example' => 'laminas-api-tools/statuslib-example', + 'zfcampus/zf-apigility' => 'laminas-api-tools/api-tools', + 'zfcampus/zf-api-problem' => 'laminas-api-tools/api-tools-api-problem', + 'zfcampus/zf-asset-manager' => 'laminas-api-tools/api-tools-asset-manager', + 'zfcampus/zf-configuration' => 'laminas-api-tools/api-tools-configuration', + 'zfcampus/zf-content-negotiation' => 'laminas-api-tools/api-tools-content-negotiation', + 'zfcampus/zf-content-validation' => 'laminas-api-tools/api-tools-content-validation', + 'zfcampus/zf-development-mode' => 'laminas/laminas-development-mode', + 'zfcampus/zf-doctrine-querybuilder' => 'laminas-api-tools/api-tools-doctrine-querybuilder', + 'zfcampus/zf-hal' => 'laminas-api-tools/api-tools-hal', + 'zfcampus/zf-http-cache' => 'laminas-api-tools/api-tools-http-cache', + 'zfcampus/zf-mvc-auth' => 'laminas-api-tools/api-tools-mvc-auth', + 'zfcampus/zf-oauth2' => 'laminas-api-tools/api-tools-oauth2', + 'zfcampus/zf-rest' => 'laminas-api-tools/api-tools-rest', + 'zfcampus/zf-rpc' => 'laminas-api-tools/api-tools-rpc', + 'zfcampus/zf-versioning' => 'laminas-api-tools/api-tools-versioning', + + // CONFIG KEYS, SCRIPT NAMES, ETC + // ZF components + '::fromZend' => '::fromLaminas', // psr7bridge + '::toZend' => '::toLaminas', // psr7bridge + 'use_zend_loader' => 'use_laminas_loader', // zend-modulemanager + 'zend-config' => 'laminas-config', + 'zend-developer-tools/' => 'laminas-developer-tools/', + 'zend-tag-cloud' => 'laminas-tag-cloud', + 'zenddevelopertools' => 'laminas-developer-tools', + 'zendbarcode' => 'laminasbarcode', + 'ZendBarcode' => 'LaminasBarcode', + 'zendcache' => 'laminascache', + 'ZendCache' => 'LaminasCache', + 'zendconfig' => 'laminasconfig', + 'ZendConfig' => 'LaminasConfig', + 'zendfeed' => 'laminasfeed', + 'ZendFeed' => 'LaminasFeed', + 'zendfilter' => 'laminasfilter', + 'ZendFilter' => 'LaminasFilter', + 'zendform' => 'laminasform', + 'ZendForm' => 'LaminasForm', + 'zendi18n' => 'laminasi18n', + 'ZendI18n' => 'LaminasI18n', + 'zendinputfilter' => 'laminasinputfilter', + 'ZendInputFilter' => 'LaminasInputFilter', + 'zendlog' => 'laminaslog', + 'ZendLog' => 'LaminasLog', + 'zendmail' => 'laminasmail', + 'ZendMail' => 'LaminasMail', + 'zendmvc' => 'laminasmvc', + 'ZendMvc' => 'LaminasMvc', + 'zendpaginator' => 'laminaspaginator', + 'ZendPaginator' => 'LaminasPaginator', + 'zendserializer' => 'laminasserializer', + 'ZendSerializer' => 'LaminasSerializer', + 'zendtag' => 'laminastag', + 'ZendTag' => 'LaminasTag', + 'zendtext' => 'laminastext', + 'ZendText' => 'LaminasText', + 'zendvalidator' => 'laminasvalidator', + 'ZendValidator' => 'LaminasValidator', + 'zendview' => 'laminasview', + 'ZendView' => 'LaminasView', + 'zend-framework.flf' => 'laminas-project.flf', + + // Expressive-related + "'zend-expressive'" => "'mezzio'", + '"zend-expressive"' => '"mezzio"', + 'zend-expressive.' => 'mezzio.', + 'zend-expressive-authorization' => 'mezzio-authorization', + 'zend-expressive-hal' => 'mezzio-hal', + 'zend-expressive-session' => 'mezzio-session', + 'zend-expressive-swoole' => 'mezzio-swoole', + 'zend-expressive-tooling' => 'mezzio-tooling', + + // Apigility-related + "'zf-apigility'" => "'api-tools'", + '"zf-apigility"' => '"api-tools"', + 'zf-apigility/' => 'api-tools/', + 'zf-apigility-admin' => 'api-tools-admin', + 'zf-content-negotiation' => 'api-tools-content-negotiation', + 'zf-hal' => 'api-tools-hal', + 'zf-rest' => 'api-tools-rest', + 'zf-rpc' => 'api-tools-rpc', + 'zf-content-validation' => 'api-tools-content-validation', + 'zf-apigility-ui' => 'api-tools-ui', + 'zf-apigility-documentation-blueprint' => 'api-tools-documentation-blueprint', + 'zf-apigility-documentation-swagger' => 'api-tools-documentation-swagger', + 'zf-apigility-welcome' => 'api-tools-welcome', + 'zf-api-problem' => 'api-tools-api-problem', + 'zf-configuration' => 'api-tools-configuration', + 'zf-http-cache' => 'api-tools-http-cache', + 'zf-mvc-auth' => 'api-tools-mvc-auth', + 'zf-oauth2' => 'api-tools-oauth2', + 'zf-versioning' => 'api-tools-versioning', + 'ZfApigilityDoctrineQueryProviderManager' => 'LaminasApiToolsDoctrineQueryProviderManager', + 'ZfApigilityDoctrineQueryCreateFilterManager' => 'LaminasApiToolsDoctrineQueryCreateFilterManager', + 'zf-apigility-doctrine' => 'api-tools-doctrine', + 'zf-development-mode' => 'laminas-development-mode', + 'zf-doctrine-querybuilder' => 'api-tools-doctrine-querybuilder', + + // 3rd party Apigility packages + 'api-skeletons/zf-' => 'api-skeletons/zf-', // api-skeletons packages + 'zf-oauth2-' => 'zf-oauth2-', // api-skeletons OAuth2-related packages + 'ZF\\OAuth2\\Client' => 'ZF\\OAuth2\\Client', // api-skeletons/zf-oauth2-client + 'ZF\\OAuth2\\Doctrine' => 'ZF\\OAuth2\\Doctrine', // api-skeletons/zf-oauth2-doctrine +]; diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Autoloader.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Autoloader.php new file mode 100644 index 0000000000..6048766a27 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Autoloader.php @@ -0,0 +1,172 @@ +loadClass($class)) { + $legacy = $namespaces[$check] + . strtr(substr($class, strlen($check)), [ + 'ApiTools' => 'Apigility', + 'Mezzio' => 'Expressive', + 'Laminas' => 'Zend', + ]); + class_alias($class, $legacy); + } + }; + } + + /** + * @return callable + */ + private static function createAppendAutoloader(array $namespaces, ArrayObject $loaded) + { + /** + * @param string $class Class name to autoload + * @return void + */ + return static function ($class) use ($namespaces, $loaded) { + $segments = explode('\\', $class); + + if ($segments[0] === 'ZendService' && isset($segments[1])) { + $segments[0] .= '\\' . $segments[1]; + unset($segments[1]); + $segments = array_values($segments); + } + + $i = 0; + $check = ''; + + // We are checking segments of the namespace to match quicker + while (isset($segments[$i + 1], $namespaces[$check . $segments[$i] . '\\'])) { + $check .= $segments[$i] . '\\'; + ++$i; + } + + if ($check === '') { + return; + } + + $alias = $namespaces[$check] + . strtr(substr($class, strlen($check)), [ + 'Apigility' => 'ApiTools', + 'Expressive' => 'Mezzio', + 'Zend' => 'Laminas', + 'AbstractZendServer' => 'AbstractZendServer', + 'ZendServerDisk' => 'ZendServerDisk', + 'ZendServerShm' => 'ZendServerShm', + 'ZendMonitor' => 'ZendMonitor', + ]); + + $loaded[$alias] = true; + if (class_exists($alias) || interface_exists($alias) || trait_exists($alias)) { + class_alias($alias, $class); + } + }; + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php new file mode 100644 index 0000000000..bac7b97479 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php @@ -0,0 +1,434 @@ + true, + 'factories' => true, + 'invokables' => true, + 'services' => true, + ]; + + /** @var array String keys => string values */ + private $exactReplacements = [ + 'zend-expressive' => 'mezzio', + 'zf-apigility' => 'api-tools', + ]; + + /** @var Replacements */ + private $replacements; + + /** @var callable[] */ + private $rulesets; + + public function __construct() + { + $this->replacements = new Replacements(); + + /* Define the rulesets for replacements. + * + * Each ruleset has the following signature: + * + * @param mixed $value + * @param string[] $keys Full nested key hierarchy leading to the value + * @return null|callable + * + * If no match is made, a null is returned, allowing it to fallback to + * the next ruleset in the list. If a match is made, a callback is returned, + * and that will be used to perform the replacement on the value. + * + * The callback should have the following signature: + * + * @param mixed $value + * @param string[] $keys + * @return mixed The transformed value + */ + $this->rulesets = [ + // Exact values + function ($value) { + return is_string($value) && isset($this->exactReplacements[$value]) + ? [$this, 'replaceExactValue'] + : null; + }, + + // Router (MVC applications) + // We do not want to rewrite these. + function ($value, array $keys) { + $key = array_pop($keys); + // Only worried about a top-level "router" key. + return $key === 'router' && count($keys) === 0 && is_array($value) + ? [$this, 'noopReplacement'] + : null; + }, + + // service- and pluginmanager handling + function ($value) { + return is_array($value) && array_intersect_key(self::SERVICE_MANAGER_KEYS_OF_INTEREST, $value) !== [] + ? [$this, 'replaceDependencyConfiguration'] + : null; + }, + + // Array values + function ($value, array $keys) { + return 0 !== count($keys) && is_array($value) + ? [$this, '__invoke'] + : null; + }, + ]; + } + + /** + * @param string[] $keys Hierarchy of keys, for determining location in + * nested configuration. + * @return array + */ + public function __invoke(array $config, array $keys = []) + { + $rewritten = []; + + foreach ($config as $key => $value) { + // Determine new key from replacements + $newKey = is_string($key) ? $this->replace($key, $keys) : $key; + + // Keep original values with original key, if the key has changed, but only at the top-level. + if (empty($keys) && $newKey !== $key) { + $rewritten[$key] = $value; + } + + // Perform value replacements, if any + $newValue = $this->replace($value, $keys, $newKey); + + // Key does not already exist and/or is not an array value + if (! array_key_exists($newKey, $rewritten) || ! is_array($rewritten[$newKey])) { + // Do not overwrite existing values with null values + $rewritten[$newKey] = array_key_exists($newKey, $rewritten) && null === $newValue + ? $rewritten[$newKey] + : $newValue; + continue; + } + + // New value is null; nothing to do. + if (null === $newValue) { + continue; + } + + // Key already exists as an array value, but $value is not an array + if (! is_array($newValue)) { + $rewritten[$newKey][] = $newValue; + continue; + } + + // Key already exists as an array value, and $value is also an array + $rewritten[$newKey] = static::merge($rewritten[$newKey], $newValue); + } + + return $rewritten; + } + + /** + * Perform substitutions as needed on an individual value. + * + * The $key is provided to allow fine-grained selection of rewrite rules. + * + * @param mixed $value + * @param string[] $keys Key hierarchy + * @param null|int|string $key + * @return mixed + */ + private function replace($value, array $keys, $key = null) + { + // Add new key to the list of keys. + // We do not need to remove it later, as we are working on a copy of the array. + array_push($keys, $key); + + // Identify rewrite strategy and perform replacements + $rewriteRule = $this->replacementRuleMatch($value, $keys); + return $rewriteRule($value, $keys); + } + + /** + * Merge two arrays together. + * + * If an integer key exists in both arrays, the value from the second array + * will be appended to the first array. If both values are arrays, they are + * merged together, else the value of the second array overwrites the one + * of the first array. + * + * Based on zend-stdlib Zend\Stdlib\ArrayUtils::merge + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * + * @return array + */ + public static function merge(array $a, array $b) + { + foreach ($b as $key => $value) { + if (! isset($a[$key]) && ! array_key_exists($key, $a)) { + $a[$key] = $value; + continue; + } + + if (null === $value && array_key_exists($key, $a)) { + // Leave as-is if value from $b is null + continue; + } + + if (is_int($key)) { + $a[] = $value; + continue; + } + + if (is_array($value) && is_array($a[$key])) { + $a[$key] = static::merge($a[$key], $value); + continue; + } + + $a[$key] = $value; + } + + return $a; + } + + /** + * @param mixed $value + * @param null|int|string $key + * @return callable Callable to invoke with value + */ + private function replacementRuleMatch($value, $key = null) + { + foreach ($this->rulesets as $ruleset) { + $result = $ruleset($value, $key); + if (is_callable($result)) { + return $result; + } + } + return [$this, 'fallbackReplacement']; + } + + /** + * Replace a value using the translation table, if the value is a string. + * + * @param mixed $value + * @return mixed + */ + private function fallbackReplacement($value) + { + return is_string($value) + ? $this->replacements->replace($value) + : $value; + } + + /** + * Replace a value matched exactly. + * + * @param mixed $value + * @return mixed + */ + private function replaceExactValue($value) + { + return $this->exactReplacements[$value]; + } + + private function replaceDependencyConfiguration(array $config) + { + $aliases = isset($config['aliases']) && is_array($config['aliases']) + ? $this->replaceDependencyAliases($config['aliases']) + : []; + + if ($aliases) { + $config['aliases'] = $aliases; + } + + $config = $this->replaceDependencyInvokables($config); + $config = $this->replaceDependencyFactories($config); + $config = $this->replaceDependencyServices($config); + + $keys = self::SERVICE_MANAGER_KEYS_OF_INTEREST; + foreach ($config as $key => $data) { + if (isset($keys[$key])) { + continue; + } + + $config[$key] = is_array($data) ? $this->__invoke($data, [$key]) : $data; + } + + return $config; + } + + /** + * Rewrite dependency aliases array + * + * In this case, we want to keep the alias as-is, but rewrite the target. + * + * We need also provide an additional alias if the alias key is a legacy class. + * + * @return array + */ + private function replaceDependencyAliases(array $aliases) + { + foreach ($aliases as $alias => $target) { + if (! is_string($alias) || ! is_string($target)) { + continue; + } + + $newTarget = $this->replacements->replace($target); + $newAlias = $this->replacements->replace($alias); + + $notIn = [$newTarget]; + $name = $newTarget; + while (isset($aliases[$name])) { + $notIn[] = $aliases[$name]; + $name = $aliases[$name]; + } + + if ($newAlias === $alias && ! in_array($alias, $notIn, true)) { + $aliases[$alias] = $newTarget; + continue; + } + + if (isset($aliases[$newAlias])) { + continue; + } + + if (! in_array($newAlias, $notIn, true)) { + $aliases[$alias] = $newAlias; + $aliases[$newAlias] = $newTarget; + } + } + + return $aliases; + } + + /** + * Rewrite dependency invokables array + * + * In this case, we want to keep the alias as-is, but rewrite the target. + * + * We need also provide an additional alias if invokable is defined with + * an alias which is a legacy class. + * + * @return array + */ + private function replaceDependencyInvokables(array $config) + { + if (empty($config['invokables']) || ! is_array($config['invokables'])) { + return $config; + } + + foreach ($config['invokables'] as $alias => $target) { + if (! is_string($alias)) { + continue; + } + + $newTarget = $this->replacements->replace($target); + $newAlias = $this->replacements->replace($alias); + + if ($alias === $target || isset($config['aliases'][$newAlias])) { + $config['invokables'][$alias] = $newTarget; + continue; + } + + $config['invokables'][$newAlias] = $newTarget; + + if ($newAlias === $alias) { + continue; + } + + $config['aliases'][$alias] = $newAlias; + + unset($config['invokables'][$alias]); + } + + return $config; + } + + /** + * @param mixed $value + * @return mixed Returns $value verbatim. + */ + private function noopReplacement($value) + { + return $value; + } + + private function replaceDependencyFactories(array $config) + { + if (empty($config['factories']) || ! is_array($config['factories'])) { + return $config; + } + + foreach ($config['factories'] as $service => $factory) { + if (! is_string($service)) { + continue; + } + + $replacedService = $this->replacements->replace($service); + $factory = is_string($factory) ? $this->replacements->replace($factory) : $factory; + $config['factories'][$replacedService] = $factory; + + if ($replacedService === $service) { + continue; + } + + unset($config['factories'][$service]); + if (isset($config['aliases'][$service])) { + continue; + } + + $config['aliases'][$service] = $replacedService; + } + + return $config; + } + + private function replaceDependencyServices(array $config) + { + if (empty($config['services']) || ! is_array($config['services'])) { + return $config; + } + + foreach ($config['services'] as $service => $serviceInstance) { + if (! is_string($service)) { + continue; + } + + $replacedService = $this->replacements->replace($service); + $serviceInstance = is_array($serviceInstance) ? $this->__invoke($serviceInstance) : $serviceInstance; + + $config['services'][$replacedService] = $serviceInstance; + + if ($service === $replacedService) { + continue; + } + + unset($config['services'][$service]); + + if (isset($config['aliases'][$service])) { + continue; + } + + $config['aliases'][$service] = $replacedService; + } + + return $config; + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Module.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Module.php new file mode 100644 index 0000000000..d10cb43dd8 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Module.php @@ -0,0 +1,54 @@ +getEventManager() + ->attach('mergeConfig', [$this, 'onMergeConfig']); + } + + /** + * Perform substitutions in the merged configuration. + * + * Rewrites keys and values matching known ZF classes, namespaces, and + * configuration keys to their Laminas equivalents. + * + * Type-hinting deliberately omitted to allow unit testing + * without dependencies on packages that do not exist yet. + * + * @param ModuleEvent $event + */ + public function onMergeConfig($event) + { + /** @var ConfigMergerInterface */ + $configMerger = $event->getConfigListener(); + $processor = new ConfigPostProcessor(); + $configMerger->setMergedConfig( + $processor( + $configMerger->getMergedConfig($returnAsObject = false) + ) + ); + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Replacements.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Replacements.php new file mode 100644 index 0000000000..ca445c01f9 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/Replacements.php @@ -0,0 +1,46 @@ +replacements = array_merge( + require __DIR__ . '/../config/replacements.php', + $additionalReplacements + ); + + // Provide multiple variants of strings containing namespace separators + foreach ($this->replacements as $original => $replacement) { + if (false === strpos($original, '\\')) { + continue; + } + $this->replacements[str_replace('\\', '\\\\', $original)] = str_replace('\\', '\\\\', $replacement); + $this->replacements[str_replace('\\', '\\\\\\\\', $original)] = str_replace('\\', '\\\\\\\\', $replacement); + } + } + + /** + * @param string $value + * @return string + */ + public function replace($value) + { + return strtr($value, $this->replacements); + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/RewriteRules.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/RewriteRules.php new file mode 100644 index 0000000000..8dc999f45e --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/RewriteRules.php @@ -0,0 +1,79 @@ + 'Mezzio\\ProblemDetails\\', + 'Zend\\Expressive\\' => 'Mezzio\\', + + // Laminas + 'Zend\\' => 'Laminas\\', + 'ZF\\ComposerAutoloading\\' => 'Laminas\\ComposerAutoloading\\', + 'ZF\\DevelopmentMode\\' => 'Laminas\\DevelopmentMode\\', + + // Apigility + 'ZF\\Apigility\\' => 'Laminas\\ApiTools\\', + 'ZF\\' => 'Laminas\\ApiTools\\', + + // ZendXml, API wrappers, zend-http OAuth support, zend-diagnostics, ZendDeveloperTools + 'ZendXml\\' => 'Laminas\\Xml\\', + 'ZendOAuth\\' => 'Laminas\\OAuth\\', + 'ZendDiagnostics\\' => 'Laminas\\Diagnostics\\', + 'ZendService\\ReCaptcha\\' => 'Laminas\\ReCaptcha\\', + 'ZendService\\Twitter\\' => 'Laminas\\Twitter\\', + 'ZendDeveloperTools\\' => 'Laminas\\DeveloperTools\\', + ]; + } + + /** + * @return array + */ + public static function namespaceReverse() + { + return [ + // ZendXml, ZendOAuth, ZendDiagnostics, ZendDeveloperTools + 'Laminas\\Xml\\' => 'ZendXml\\', + 'Laminas\\OAuth\\' => 'ZendOAuth\\', + 'Laminas\\Diagnostics\\' => 'ZendDiagnostics\\', + 'Laminas\\DeveloperTools\\' => 'ZendDeveloperTools\\', + + // Zend Service + 'Laminas\\ReCaptcha\\' => 'ZendService\\ReCaptcha\\', + 'Laminas\\Twitter\\' => 'ZendService\\Twitter\\', + + // Zend + 'Laminas\\' => 'Zend\\', + + // Expressive + 'Mezzio\\ProblemDetails\\' => 'Zend\\ProblemDetails\\', + 'Mezzio\\' => 'Zend\\Expressive\\', + + // Laminas to ZfCampus + 'Laminas\\ComposerAutoloading\\' => 'ZF\\ComposerAutoloading\\', + 'Laminas\\DevelopmentMode\\' => 'ZF\\DevelopmentMode\\', + + // Apigility + 'Laminas\\ApiTools\\Admin\\' => 'ZF\\Apigility\\Admin\\', + 'Laminas\\ApiTools\\Doctrine\\' => 'ZF\\Apigility\\Doctrine\\', + 'Laminas\\ApiTools\\Documentation\\' => 'ZF\\Apigility\\Documentation\\', + 'Laminas\\ApiTools\\Example\\' => 'ZF\\Apigility\\Example\\', + 'Laminas\\ApiTools\\Provider\\' => 'ZF\\Apigility\\Provider\\', + 'Laminas\\ApiTools\\Welcome\\' => 'ZF\\Apiglity\\Welcome\\', + 'Laminas\\ApiTools\\' => 'ZF\\', + ]; + } +} diff --git a/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/autoload.php b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/autoload.php new file mode 100644 index 0000000000..9f2f2adf85 --- /dev/null +++ b/wcfsetup/install/files/lib/system/api/laminas/laminas-zendframework-bridge/src/autoload.php @@ -0,0 +1,9 @@ +