diff --git a/.travis.yml b/.travis.yml index 66d19569..2a1ba140 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,15 @@ matrix: - php: 7.3 env: - DEPS=latest + - php: 7.4 + env: + - DEPS=lowest + - php: 7.4 + env: + - DEPS=locked + - php: 7.4 + env: + - DEPS=latest before_install: - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index e2225b96..96f5da37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 2.1.6 - TBD +## 2.3.0 - TBD ### Added @@ -24,6 +24,94 @@ All notable changes to this project will be documented in this file, in reverse - Nothing. +## 2.2.2 - TBD + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.2.1 - 2019-11-13 + +### Added + +- Nothing. + +### Changed + +- [#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 + +- [#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 + +- [#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 + +- [#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 @@ -304,6 +392,30 @@ All notable changes to this project will be documented in this file, in reverse - Nothing. +## 1.8.7 - 2019-08-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#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 @@ -619,7 +731,7 @@ All notable changes to this project will be documented in this file, in reverse - [#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: + 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. diff --git a/composer.json b/composer.json index 5e26fdd6..738d3ecf 100644 --- a/composer.json +++ b/composer.json @@ -36,9 +36,12 @@ "ext-libxml": "*", "http-interop/http-factory-tests": "^0.5.0", "php-http/psr7-integration-tests": "dev-master", - "phpunit/phpunit": "^7.0.2", + "phpunit/phpunit": "^7.5.18", "zendframework/zend-coding-standard": "~1.0.0" }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, "provide": { "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" diff --git a/composer.lock b/composer.lock index 32d45d1e..1e073ae8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1460d979a214badb7a4393d3b770d676", + "content-hash": "1bac61830d3bc9c8234592861c735f58", "packages": [ { "name": "psr/http-factory", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c" + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c", - "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "request", "response" ], - "time": "2018-07-30T21:54:04+00:00" + "time": "2019-04-30T12:38:16+00:00" }, { "name": "psr/http-message", @@ -112,27 +112,29 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -157,12 +159,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "http-interop/http-factory-tests", @@ -210,16 +212,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { @@ -254,7 +256,7 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2019-08-09T12:45:53+00:00" }, { "name": "phar-io/manifest", @@ -364,25 +366,25 @@ "source": { "type": "git", "url": "https://github.com/php-http/psr7-integration-tests.git", - "reference": "5dfefb2da33ca24ae20c971b725c9a6fe7403008" + "reference": "c3bb79ca4a276df57364ff45bf2f619f769ded4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/psr7-integration-tests/zipball/5dfefb2da33ca24ae20c971b725c9a6fe7403008", - "reference": "5dfefb2da33ca24ae20c971b725c9a6fe7403008", + "url": "https://api.github.com/repos/php-http/psr7-integration-tests/zipball/c3bb79ca4a276df57364ff45bf2f619f769ded4a", + "reference": "c3bb79ca4a276df57364ff45bf2f619f769ded4a", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0", + "php": "^5.5 || ^7.0", "phpunit/phpunit": "^5.4 || ^6.0 || ^7.0", "psr/http-message": "^1.0" }, "require-dev": { "guzzlehttp/psr7": "^1.4", - "nyholm/psr7": "dev-master", + "nyholm/psr7": "^1.0", "ringcentral/psr7": "^1.2", - "slim/http": "^0.3", - "zendframework/zend-diactoros": "^1.8" + "slim/psr7": "dev-master", + "zendframework/zend-diactoros": "^2.1" }, "type": "library", "extra": { @@ -411,39 +413,37 @@ "psr-7", "test" ], - "time": "2018-09-02T10:01:55+00:00" + "time": "2019-02-16T08:31:47+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -465,30 +465,30 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", "webmozart/assert": "^1.0" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", + "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.4" }, @@ -516,41 +516,40 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2019-09-12T14:27:41+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -563,26 +562,27 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -597,8 +597,8 @@ } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -626,20 +626,20 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.0.7", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { @@ -650,7 +650,7 @@ "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -663,7 +663,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -678,8 +678,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", @@ -689,25 +689,28 @@ "testing", "xunit" ], - "time": "2018-06-01T07:51:50+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -726,8 +729,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", @@ -736,7 +739,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11T11:44:00+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -781,16 +784,16 @@ }, { "name": "phpunit/php-timer", - "version": "2.0.0", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { @@ -802,7 +805,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -817,8 +820,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], "description": "Utility class for timing", @@ -826,20 +829,20 @@ "keywords": [ "timer" ], - "time": "2018-02-01T13:07:23+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.0.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { @@ -852,7 +855,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -875,20 +878,20 @@ "keywords": [ "tokenizer" ], - "time": "2018-02-01T13:16:43+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "7.3.4", + "version": "7.5.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0356331bf62896dc56e3a15030b23b73f38b2935" + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0356331bf62896dc56e3a15030b23b73f38b2935", - "reference": "0356331bf62896dc56e3a15030b23b73f38b2935", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", "shasum": "" }, "require": { @@ -906,14 +909,14 @@ "phpunit/php-code-coverage": "^6.0.7", "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", + "phpunit/php-timer": "^2.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", + "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { @@ -933,7 +936,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.3-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -948,8 +951,8 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], "description": "The PHP Unit Testing framework.", @@ -959,7 +962,7 @@ "testing", "xunit" ], - "time": "2018-09-05T09:58:53+00:00" + "time": "2019-12-06T05:14:37+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1072,23 +1075,23 @@ }, { "name": "sebastian/diff", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", @@ -1124,32 +1127,35 @@ "unidiff", "unified diff" ], - "time": "2018-06-10T07:54:39+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1174,20 +1180,20 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { @@ -1214,6 +1220,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1222,17 +1232,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1241,7 +1247,7 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", @@ -1441,25 +1447,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1479,7 +1485,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -1526,16 +1532,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "2acf168de78487db620ab4bc524135a13cfe6745" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", + "reference": "2acf168de78487db620ab4bc524135a13cfe6745", "shasum": "" }, "require": { @@ -1600,20 +1606,78 @@ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2018-11-07T22:31:41+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-11-27T13:56:44+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { @@ -1640,35 +1704,33 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.6.0" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1690,7 +1752,7 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2019-11-24T13:36:37+00:00" }, { "name": "zendframework/zend-coding-standard", diff --git a/docs/book/index.html b/docs/book/index.html deleted file mode 100644 index 35edad9b..00000000 --- a/docs/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
-

zend-diactoros

- -

PSR-7 HTTP message implementation.

- -
$ composer require zendframework/zend-diactoros
-
-
- diff --git a/docs/book/v1/api.md b/docs/book/v1/api.md index 8705ee8c..c016ae90 100644 --- a/docs/book/v1/api.md +++ b/docs/book/v1/api.md @@ -75,7 +75,7 @@ Like the `Request` and `ServerRequest`, responses are immutable. Any methods tha ### HtmlResponse and JsonResponse -- Added in 1.1.0 +> Available since version 1.1.0 The most common use case in server-side applications for generating responses is to provide a string to use for the response, typically HTML or data to serialize as JSON. `Zend\Diactoros\Response\HtmlResponse` and `Zend\Diactoros\Response\JsonResponse` exist to facilitate these use cases: @@ -128,9 +128,9 @@ $request = RequestFactory::fromGlobals( ); ``` -### ServerRequestFactory helper functions +### ServerRequestFactory Helper Functions -- Since 1.8.0 +> Available since version 1.8.0 In order to create the various artifacts required by a `ServerRequest` instance, Diactoros also provides a number of functions under the `Zend\Diactoros` diff --git a/docs/book/v1/custom-responses.md b/docs/book/v1/custom-responses.md index d1f4bb19..06eda06e 100644 --- a/docs/book/v1/custom-responses.md +++ b/docs/book/v1/custom-responses.md @@ -60,7 +60,7 @@ Headers must be in the same format as you would provide to the ## XML Responses -- Since 1.7.0 +> Available since version 1.7.0 `Zend\Diactoros\Response\XmlResponse` allows specifying XML as a payload, and sets the `Content-Type` header to `application/xml` by default: @@ -180,7 +180,7 @@ $uri = $request->getUri(); $response = new RedirectResponse($uri->withPath('/login')); ``` -## Creating custom responses +## Creating custom Responses PHP allows constructor overloading. What this means is that constructors of extending classes can define completely different argument sets without conflicting with the parent implementation. diff --git a/docs/book/v1/emitting-responses.md b/docs/book/v1/emitting-responses.md index b682fa4e..c32b68e7 100644 --- a/docs/book/v1/emitting-responses.md +++ b/docs/book/v1/emitting-responses.md @@ -1,6 +1,6 @@ -# Emitting responses +# Emitting Responses -> ## Deprecated +> ### Deprecated > > Emitters are deprecated from Diactoros starting with version 1.8.0. The > functionality is now available for any PSR-7 implementation via the package @@ -29,7 +29,7 @@ $emitter = new Zend\Diactoros\Response\SapiEmitter(); $emitter->emit($response); ``` -## Emitting ranges of streamed files +## Emitting Ranges of streamed Files The `SapiStreamEmitter` is useful when you want to emit a `Content-Range`. As an example, to stream a range of bytes from a file to a client, the client can pass @@ -53,8 +53,8 @@ $response = new Response($body); $response = $response->withHeader('Content-Range', $range); ``` -> Note: you will likely want to ensure the range specified falls within the -> content size of the streamed body! +(Note: you will likely want to ensure the range specified falls within the +content size of the streamed body!) The `SapiStreamEmitter` detects the `Content-Range` header and emits only the bytes specified. diff --git a/docs/book/v1/install.md b/docs/book/v1/install.md index c9033fd6..0dac69ec 100644 --- a/docs/book/v1/install.md +++ b/docs/book/v1/install.md @@ -1,4 +1,4 @@ -# Installation and Requirements +# Installation Install this library using composer: diff --git a/docs/book/v1/overview.md b/docs/book/v1/overview.md index 16dbf99b..bb7f8fe4 100644 --- a/docs/book/v1/overview.md +++ b/docs/book/v1/overview.md @@ -1,4 +1,4 @@ -# zend-diactoros: HTTP Messages +# Overview `zend-diactoros` is a PHP package containing implementations of the [accepted PSR-7 HTTP message interfaces](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md), as diff --git a/docs/book/v1/serialization.md b/docs/book/v1/serialization.md index ba22c377..aa3b5576 100644 --- a/docs/book/v1/serialization.md +++ b/docs/book/v1/serialization.md @@ -32,7 +32,7 @@ the following static methods: The deserialization methods (`fromArray()`) will raise exceptions if errors occur while parsing the message. -### Example usage +### Example Usage Array serialization can be usesful for log messages: diff --git a/docs/book/v1/usage.md b/docs/book/v1/usage.md index 80406c2d..aea1d72f 100644 --- a/docs/book/v1/usage.md +++ b/docs/book/v1/usage.md @@ -60,7 +60,7 @@ illustration of a possible implementation.) Server-side applications will need to marshal the incoming request based on superglobals, and will then populate and send a response. -### Marshaling an incoming request +### Marshaling an incoming Request PHP contains a plethora of information about the incoming request, and keeps that information in a variety of locations. `Zend\Diactoros\ServerRequestFactory::fromGlobals()` can simplify marshaling @@ -94,7 +94,7 @@ in the name were renamed with underlines. By getting the cookies directly from t access to the original cookies in the way you set them in your application and they are send by the user agent. -### Manipulating the response +### Manipulating the Response Use the response object to add headers and provide content for the response. Writing to the body does not create a state change in the response, so it can be done without capturing the return @@ -116,7 +116,7 @@ $response = $response ->withAddedHeader('X-Show-Something', 'something'); ``` -### "Serving" an application +### "Serving" an Application > ### Deprecated > diff --git a/docs/book/v2/api.md b/docs/book/v2/api.md index d4ff1886..a37cfb46 100644 --- a/docs/book/v2/api.md +++ b/docs/book/v2/api.md @@ -126,7 +126,7 @@ $request = RequestFactory::fromGlobals( ); ``` -### ServerRequestFactory helper functions +### ServerRequestFactory Helper Functions In order to create the various artifacts required by a `ServerRequest` instance, Diactoros also provides a number of functions under the `Zend\Diactoros` diff --git a/docs/book/v2/custom-responses.md b/docs/book/v2/custom-responses.md index a5a34415..12b0f393 100644 --- a/docs/book/v2/custom-responses.md +++ b/docs/book/v2/custom-responses.md @@ -146,9 +146,9 @@ EOF; $response = new Zend\Diactoros\Response\CsvResponse($csvContent); ``` -The constructor accepts three additional arguments: +The constructor accepts three additional arguments: -- A status code +- A status code - A filename, if the response is to be sent as a download - An array of supplemental headers @@ -159,7 +159,6 @@ $response = new Zend\Diactoros\Response\TextResponse( 'monthly-sports-report.csv', ['X-Generated-By' => ['zend-diactoros']] ); -``` ## Empty Responses @@ -239,7 +238,7 @@ $uri = $request->getUri(); $response = new RedirectResponse($uri->withPath('/login')); ``` -## Creating custom responses +## Creating custom Responses PHP allows constructor overloading. What this means is that constructors of extending classes can define completely different argument sets without conflicting with the parent implementation. diff --git a/docs/book/v2/factories.md b/docs/book/v2/factories.md index 87fa7eaa..6cc19e70 100644 --- a/docs/book/v2/factories.md +++ b/docs/book/v2/factories.md @@ -1,4 +1,4 @@ -# HTTP Message Factories +# Factories [PSR-17](https://www.php-fig.org/psr/psr-17/) defines factory interfaces for creating [PSR-7](https://www.php-fig.org/psr/psr-7/) instances. As of version diff --git a/docs/book/v2/install.md b/docs/book/v2/install.md index 0c4a0ec3..d05b3202 100644 --- a/docs/book/v2/install.md +++ b/docs/book/v2/install.md @@ -1,4 +1,4 @@ -# Installation and Requirements +# Installation Install this library using composer: diff --git a/docs/book/v2/migration.md b/docs/book/v2/migration.md index 1852510f..ef1439d0 100644 --- a/docs/book/v2/migration.md +++ b/docs/book/v2/migration.md @@ -1,4 +1,4 @@ -# Migration to version 2 +# Migration to Version 2 If you are only using the PSR-7 implementations (e.g., `Request`, `Response`, `ServerRequest`, etc.), migrating to v2 can be done by updating your @@ -64,7 +64,7 @@ to provide these capabilities instead. Usage is similar, but the `RequestHandlerRunner` provides better error handling, and integration with emitters. -### ServerRequestFactory methods +### ServerRequestFactory Methods A number of public static methods have been removed from `ServerRequestFactory`. The following table details the methods removed, and diff --git a/docs/book/v2/overview.md b/docs/book/v2/overview.md index de8d5715..2969f567 100644 --- a/docs/book/v2/overview.md +++ b/docs/book/v2/overview.md @@ -1,4 +1,4 @@ -# zend-diactoros: HTTP Messages +# Overview `zend-diactoros` is a PHP package containing implementations of the [PSR-7 HTTP message interfaces](https://www.php-fig.org/psr/psr-7/), diff --git a/docs/book/v2/serialization.md b/docs/book/v2/serialization.md index ba22c377..aa3b5576 100644 --- a/docs/book/v2/serialization.md +++ b/docs/book/v2/serialization.md @@ -32,7 +32,7 @@ the following static methods: The deserialization methods (`fromArray()`) will raise exceptions if errors occur while parsing the message. -### Example usage +### Example Usage Array serialization can be usesful for log messages: diff --git a/docs/book/v2/usage.md b/docs/book/v2/usage.md index d0f38258..3ee41f12 100644 --- a/docs/book/v2/usage.md +++ b/docs/book/v2/usage.md @@ -60,7 +60,7 @@ illustration of a possible implementation.) Server-side applications will need to marshal the incoming request based on superglobals, and will then populate and send a response. -### Marshaling an incoming request +### Marshaling an incoming Request PHP contains a plethora of information about the incoming request, and keeps that information in a variety of locations. `Zend\Diactoros\ServerRequestFactory::fromGlobals()` can simplify marshaling @@ -94,7 +94,7 @@ in the name were renamed with underlines. By getting the cookies directly from t access to the original cookies in the way you set them in your application and they are send by the user agent. -### Manipulating the response +### Manipulating the Response Use the response object to add headers and provide content for the response. Writing to the body does not create a state change in the response, so it can be done without capturing the return diff --git a/mkdocs.yml b/mkdocs.yml index a063c0c6..a06e923f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,7 +5,7 @@ extra: versions: - v2 - v1 -pages: +nav: - Home: index.md - v2: - Overview: v2/overview.md @@ -16,7 +16,8 @@ pages: - "Custom Responses": v2/custom-responses.md - Serialization: v2/serialization.md - API: v2/api.md - - Migration: v2/migration.md + - Migration: + - "Migration to Version 2": v2/migration.md - v1: - Overview: v1/overview.md - Installation: v1/install.md @@ -35,5 +36,5 @@ pages: - "_reference-serialization": serialization.md - "_reference-api": api.md site_name: zend-diactoros -site_description: 'PSR-7 HTTP message implementations.' -repo_url: 'https://github.com/zendframework/zend-diactoros' +site_description: "PSR-7 HTTP message implementations" +repo_url: "https://github.com/zendframework/zend-diactoros" diff --git a/src/functions/marshal_uri_from_sapi.php b/src/functions/marshal_uri_from_sapi.php index 9d4de236..bc6545c7 100644 --- a/src/functions/marshal_uri_from_sapi.php +++ b/src/functions/marshal_uri_from_sapi.php @@ -80,7 +80,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri * @return array Array of two items, host and port, in that order (can be * passed to a list() operation). */ - $marshalIpv6HostAndPort = function (array $server, string $host, ?int $port) : array { + $marshalIpv6HostAndPort = function (array $server, ?int $port) : array { $host = '[' . $server['SERVER_ADDR'] . ']'; $port = $port ?: 80; if ($port . ']' === substr($host, strrpos($host, ':') + 1)) { @@ -93,8 +93,14 @@ function marshalUriFromSapi(array $server, array $headers) : Uri static $defaults = ['', null]; - if ($getHeaderFromArray('host', $headers, false)) { - return $marshalHostAndPortFromHeader($getHeaderFromArray('host', $headers)); + $forwardedHost = $getHeaderFromArray('x-forwarded-host', $headers, false); + if ($forwardedHost !== false) { + return $marshalHostAndPortFromHeader($forwardedHost); + } + + $host = $getHeaderFromArray('host', $headers, false); + if ($host !== false) { + return $marshalHostAndPortFromHeader($host); } if (! isset($server['SERVER_NAME'])) { @@ -112,7 +118,7 @@ function marshalUriFromSapi(array $server, array $headers) : Uri // Misinterpreted IPv6-Address // Reported for Safari on Windows - return $marshalIpv6HostAndPort($server, $host, $port); + return $marshalIpv6HostAndPort($server, $port); }; /** diff --git a/test/MessageTraitTest.php b/test/MessageTraitTest.php index 3b2f3b45..71b165ec 100644 --- a/test/MessageTraitTest.php +++ b/test/MessageTraitTest.php @@ -24,7 +24,7 @@ class MessageTraitTest extends TestCase */ protected $message; - public function setUp() + protected function setUp() : void { $this->message = new Request(null, null, $this->createMock(StreamInterface::class)); } diff --git a/test/PhpInputStreamTest.php b/test/PhpInputStreamTest.php index f57b5b92..f3277d72 100644 --- a/test/PhpInputStreamTest.php +++ b/test/PhpInputStreamTest.php @@ -27,7 +27,7 @@ class PhpInputStreamTest extends TestCase */ protected $stream; - public function setUp() + protected function setUp() : void { $this->file = __DIR__ . '/TestAsset/php-input-stream.txt'; $this->stream = new PhpInputStream($this->file); diff --git a/test/RequestTest.php b/test/RequestTest.php index 486b2069..775f2888 100644 --- a/test/RequestTest.php +++ b/test/RequestTest.php @@ -23,7 +23,7 @@ class RequestTest extends TestCase */ protected $request; - public function setUp() + protected function setUp() : void { $this->request = new Request(); } diff --git a/test/ResponseTest.php b/test/ResponseTest.php index 304ddf1e..03e13def 100644 --- a/test/ResponseTest.php +++ b/test/ResponseTest.php @@ -42,7 +42,7 @@ class ResponseTest extends TestCase */ protected $response; - public function setUp() + protected function setUp() : void { $this->response = new Response(); } @@ -223,7 +223,7 @@ public function testCreateWithValidStatusCodes($code) $result = $response->getStatusCode(); $this->assertSame((int) $code, $result); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); } public function validStatusCodes() @@ -311,7 +311,7 @@ public function testConstructorRaisesExceptionForInvalidHeaders($headers, $conta public function testReasonPhraseCanBeEmpty() { $response = $this->response->withStatus(555); - $this->assertInternalType('string', $response->getReasonPhrase()); + $this->assertIsString($response->getReasonPhrase()); $this->assertEmpty($response->getReasonPhrase()); } diff --git a/test/ServerRequestFactoryTest.php b/test/ServerRequestFactoryTest.php index 1ff380d3..26d23900 100644 --- a/test/ServerRequestFactoryTest.php +++ b/test/ServerRequestFactoryTest.php @@ -275,7 +275,7 @@ public function testMarshalUriDetectsHttpsSchemeFromServerValue($param) $request = $request->withHeader('Host', 'example.com'); $server = [ - $param => true, + $param => 'on', ]; $uri = marshalUriFromSapi($server, $request->getHeaders()); diff --git a/test/ServerRequestTest.php b/test/ServerRequestTest.php index 0306df95..4a88f05d 100644 --- a/test/ServerRequestTest.php +++ b/test/ServerRequestTest.php @@ -23,7 +23,7 @@ class ServerRequestTest extends TestCase */ protected $request; - public function setUp() + protected function setUp() : void { $this->request = new ServerRequest(); } @@ -182,7 +182,7 @@ public function testUsesProvidedConstructorArguments($parameterMethod, $methodRe public function testCookieParamsAreAnEmptyArrayAtInitialization() { $request = new ServerRequest(); - $this->assertInternalType('array', $request->getCookieParams()); + $this->assertIsArray($request->getCookieParams()); $this->assertCount(0, $request->getCookieParams()); } @@ -192,7 +192,7 @@ public function testCookieParamsAreAnEmptyArrayAtInitialization() public function testQueryParamsAreAnEmptyArrayAtInitialization() { $request = new ServerRequest(); - $this->assertInternalType('array', $request->getQueryParams()); + $this->assertIsArray($request->getQueryParams()); $this->assertCount(0, $request->getQueryParams()); } diff --git a/test/StreamTest.php b/test/StreamTest.php index 495a2592..bd2ffbe9 100644 --- a/test/StreamTest.php +++ b/test/StreamTest.php @@ -46,13 +46,13 @@ class StreamTest extends TestCase */ protected $stream; - public function setUp() + protected function setUp() : void { $this->tmpnam = null; $this->stream = new Stream('php://memory', 'wb+'); } - public function tearDown() + protected function tearDown() : void { if ($this->tmpnam && file_exists($this->tmpnam)) { unlink($this->tmpnam); diff --git a/test/UploadedFileTest.php b/test/UploadedFileTest.php index 35ab5edb..7bf4fd7e 100644 --- a/test/UploadedFileTest.php +++ b/test/UploadedFileTest.php @@ -39,12 +39,12 @@ class UploadedFileTest extends TestCase { protected $tmpFile; - public function setUp() + protected function setUp() : void { $this->tmpfile = null; } - public function tearDown() + protected function tearDown() : void { if (is_string($this->tmpFile) && file_exists($this->tmpFile)) { unlink($this->tmpFile); diff --git a/test/functions/MarshalUriFromSapiTest.php b/test/functions/MarshalUriFromSapiTest.php index 94fab436..1bd66cda 100644 --- a/test/functions/MarshalUriFromSapiTest.php +++ b/test/functions/MarshalUriFromSapiTest.php @@ -5,7 +5,7 @@ * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ -declare(strict_types = 1); +declare(strict_types=1); namespace ZendTest\Diactoros\functions; @@ -51,8 +51,7 @@ public function testReturnsUrlWithCorrectHttpSchemeFromArrays(string $httpsValue 'HTTP_ACCEPT_LANGUAGE' => 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br', 'HTTP_REFERER' => 'http://localhost:8080/index.html', - 'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)' - . ' Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36', + 'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)', 'HTTP_ACCEPT' => 'application/json,*/*', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_HOST' => 'localhost:8080', @@ -74,4 +73,40 @@ public function returnsUrlWithCorrectHttpSchemeFromArraysProvider() : array 'empty' => ['', 'http'], ]; } + + /** + * @dataProvider returnsUrlWithCorrectSchemeAndHostFromArrays + */ + public function testReturnsUrlWithCorrectSchemeAndHostFromArrays( + string $expectedScheme, + string $expectedHost, + array $server, + array $headers + ) : void { + $uri = marshalUriFromSapi($server, $headers); + self::assertSame($expectedScheme, $uri->getScheme()); + self::assertSame($expectedHost, $uri->getHost()); + } + + public function returnsUrlWithCorrectSchemeAndHostFromArrays() : array + { + return [ + 'x-forwarded-proto' => [ + 'https', + 'localhost', + [ + 'SERVER_NAME' => 'localhost', + ], + ['X-Forwarded-Proto' => 'https'], + ], + 'x-forwarded-host' => [ + 'http', + 'example.org', + [ + 'SERVER_NAME' => 'localhost', + ], + ['X-Forwarded-Host' => 'example.org', 'Host' => 'localhost'], + ], + ]; + } }