From 2eaa8c86973b2a9a14f717128bec03ffe1fff277 Mon Sep 17 00:00:00 2001 From: Joe Ginley Date: Mon, 3 Feb 2020 22:44:09 -0500 Subject: [PATCH] Added 7.4 to travis.yml. Fixed a bug where not all request headers were available when running under apache server. --- .travis.yml | 1 + src/Message/ServerRequest.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95b05d9..161dea8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: php php: - "7.2" - "7.3" + - "7.4" before_script: - composer selfupdate diff --git a/src/Message/ServerRequest.php b/src/Message/ServerRequest.php index 4329901..57a36de 100644 --- a/src/Message/ServerRequest.php +++ b/src/Message/ServerRequest.php @@ -479,14 +479,19 @@ class ServerRequest extends Request implements ServerRequestInterface */ protected function getServerRequestHeaders() { - // http://www.php.net/manual/en/function.getallheaders.php#84262 - $headers = array(); - foreach ($_SERVER as $name => $value) { - if (substr($name, 0, 5) === "HTTP_") { - $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value; + if (!function_exists('apache_get_version')) { + // http://www.php.net/manual/en/function.getallheaders.php#84262 + $headers = array(); + foreach ($_SERVER as $name => $value) { + if (substr($name, 0, 5) === "HTTP_") { + $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value; + } } + return $headers; + } + else { + return apache_request_headers(); } - return $headers; } /**