Fixed bad host header in PSR-7 (if using 'php -S localhost:8000 system/router.php')

This commit is contained in:
Matias Griese
2019-01-30 20:51:09 +02:00
parent 610c6c341c
commit d45efb484c
3 changed files with 23 additions and 16 deletions

View File

@@ -8,6 +8,7 @@
* Fixed a bug in `FormFlashFile::moveTo()` not deleting the old file
* Fixed `FlexMediaTrait::getMedia()` trying to include uploaded but already moved media
* Fixed `ImageMedium` constructor warning when file does not exist
* Fixed bad host header in PSR-7 (if using 'php -S localhost:8000 system/router.php')
# v1.6.0-beta.8
## 01/25/2019

30
composer.lock generated
View File

@@ -52,16 +52,16 @@
},
{
"name": "composer/ca-bundle",
"version": "1.1.3",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
"reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
"reference": "558f321c52faeb4828c03e7dc0cfe39a09e09a2d",
"shasum": ""
},
"require": {
@@ -104,7 +104,7 @@
"ssl",
"tls"
],
"time": "2018-10-18T06:09:13+00:00"
"time": "2019-01-28T09:30:10+00:00"
},
{
"name": "doctrine/cache",
@@ -538,17 +538,17 @@
},
{
"name": "gregwar/image",
"version": "v2.0.23",
"version": "v2.0.24",
"target-dir": "Gregwar/Image",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/Image.git",
"reference": "25fbb91a95d41d44587ee7ca8923745b66221a7d"
"reference": "52145816255dd20cb4bb115d0f9e1030c6287994"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/Image/zipball/25fbb91a95d41d44587ee7ca8923745b66221a7d",
"reference": "25fbb91a95d41d44587ee7ca8923745b66221a7d",
"url": "https://api.github.com/repos/Gregwar/Image/zipball/52145816255dd20cb4bb115d0f9e1030c6287994",
"reference": "52145816255dd20cb4bb115d0f9e1030c6287994",
"shasum": ""
},
"require": {
@@ -586,7 +586,7 @@
"gd",
"image"
],
"time": "2018-10-25T17:12:13+00:00"
"time": "2019-01-27T15:10:06+00:00"
},
{
"name": "guzzlehttp/psr7",
@@ -3928,16 +3928,16 @@
},
{
"name": "sebastian/environment",
"version": "4.0.1",
"version": "4.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f"
"reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f",
"reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4a43e9af57b4afa663077b9bc85255dbc6e8a2bd",
"reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd",
"shasum": ""
},
"require": {
@@ -3974,7 +3974,7 @@
"environment",
"hhvm"
],
"time": "2018-11-25T09:31:21+00:00"
"time": "2019-01-28T15:26:03+00:00"
},
{
"name": "sebastian/exporter",

View File

@@ -26,7 +26,13 @@ class RequestServiceProvider implements ServiceProviderInterface
$psr17Factory // StreamFactory
);
return $creator->fromGlobals();
$request = $creator->fromGlobals();
// TODO: Remove workaround for bad host header (if using 'php -S localhost:8000 system/router.php').
$hosts = $request->getHeader('Host');
$host = end($hosts);
return $request->withHeader('Host', $host);
};
}
}