Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F803888
D456.id1186.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:00 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:00 AM (8 h, 7 m)
Engine
blob
Format
Raw Data
Handle
576611
Attached To
D456: INP-1850 - Repair the "kHTTPQuery::getHeaders" method
D456.id1186.diff
View Options
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
Log In to Comment