Page MenuHomeIn-Portal Phabricator

D456.id1186.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 9:00 AM

D456.id1186.diff

Index: branches/5.2.x/core/kernel/utility/http_query.php
===================================================================
--- branches/5.2.x/core/kernel/utility/http_query.php
+++ branches/5.2.x/core/kernel/utility/http_query.php
@@ -795,18 +795,20 @@
// If apache_request_headers() exists...
$headers = apache_request_headers();
- if ( $headers ) {
- return $headers; // And works... Use it
+ if ( $headers !== false ) {
+ return $headers; // And works... Use it.
}
}
$headers = array();
- foreach ( array_keys($_SERVER) as $server_key ) {
- if ( substr($server_key, 0, 5) == 'HTTP_' ) {
- $header_name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($server_key, 0, 5)))));
- $headers[$header_name] = $_SERVER[$server_key];
- }
+ $header_server_keys = array_filter(array_keys($_SERVER), function ($server_key) {
+ return strpos($server_key, 'HTTP_') === 0;
+ });
+
+ foreach ( $header_server_keys as $server_key ) {
+ $header_name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($server_key, 5)))));
+ $headers[$header_name] = $_SERVER[$server_key];
}
return $headers;

Event Timeline