@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove unreached header forwarding code in AphrontRequest

Summary:
Static code analysis complained `Cannot unset offset 'Authorization'|'Host' on array<int<0, max>, array{string, mixed}>.`

Per avivey's look at the code, we only ever get headers in the form of X-Hgargs-* in $headers anyway, so the special-case here won't ever happen. Delete this code.

Also see similar code at the bottom of `AphrontHTTPProxyResponse.php`.

Test Plan: Read the code.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25743

+2 -19
+2 -19
src/aphront/AphrontRequest.php
··· 894 894 } 895 895 896 896 $headers = array(); 897 - $seen = array(); 898 897 899 898 // NOTE: apache_request_headers() might provide a nicer way to do this, 900 899 // but isn't available under FCGI until PHP 5.4.0. ··· 920 919 921 920 if ($should_forward) { 922 921 $headers[] = array($key, $value); 923 - $seen[$key] = true; 924 922 } 925 923 } 926 924 927 925 // In some situations, this may not be mapped into the HTTP_X constants. 928 926 // CONTENT_LENGTH is similarly affected, but we trust cURL to take care 929 927 // of that if it matters, since we're handing off a request body. 930 - if (empty($seen['Content-Type'])) { 931 - if (isset($_SERVER['CONTENT_TYPE'])) { 932 - $headers[] = array('Content-Type', $_SERVER['CONTENT_TYPE']); 933 - } 934 - } 935 - 936 - foreach ($headers as $header) { 937 - list($key, $value) = $header; 938 - switch ($key) { 939 - case 'Host': 940 - case 'Authorization': 941 - // Don't forward these headers, we've already handled them elsewhere. 942 - unset($headers[$key]); 943 - break; 944 - default: 945 - break; 946 - } 928 + if (isset($_SERVER['CONTENT_TYPE'])) { 929 + $headers[] = array('Content-Type', $_SERVER['CONTENT_TYPE']); 947 930 } 948 931 949 932 foreach ($headers as $header) {