Superglobal $_SERVER, used in all patches for missing getallheaders() contains only truly basic headers. To pass ANY header into PHP in any httpd environment, including CGI/FCGI just add rule (any number of rules) into .htaccess:
RewriteRule .* - [E=HTTP_MY_HEADER:%{HTTP:My-Header}]
and the header with it's value will appear for PHP as
<?php print $_SERVER['HTTP_MY_HEADER']; ?>
And... just couldn't hold off. Rewrtiting $_SERVER keys for replacing missing function really does not require RegExps, preg_matches or evals... Try this:
<?php
function getallheaders() {
foreach($_SERVER as $K=>$V){$a=explode('_' ,$K);
if(array_shift($a)=='HTTP'){
array_walk($a,function(&$v){$v=ucfirst(strtolower($v));});
$retval[join('-',$a)]=$V;}
} return $retval; }
?>