added Uri::getAllHeaders() compatibility

This commit is contained in:
Andy Miller
2020-09-28 18:35:01 -06:00
parent df4cbdcc09
commit e3ba3a3ea4
2 changed files with 20 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
# v1.7.0-rc.17
## mm/dd/2020
1. [](#new)
* Added a `getAllHeaders()` compatibility function
1. [](#improved)
* Fall back through various templates scenarios if they don't exist in theme to avoid unhelpful error.
* Added default templates for `external.html.twig`, `default.html.twig`, and `modular.html.twig`

View File

@@ -1436,6 +1436,24 @@ class Uri
return $this;
}
/**
* Compatibility in case getallheaders() is not available on platform
*/
public static function getAllHeaders()
{
if (!function_exists('getallheaders')) {
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
return getallheaders();
}
/**
* Get the base URI with port if needed
*