From 878b2aa09662a468bad1c9441f9fa17a4400c4e9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 6 Dec 2017 12:45:44 -0500 Subject: [PATCH] Fix headers --- api/autoload.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/autoload.php b/api/autoload.php index 0f14ff20..33ac8300 100644 --- a/api/autoload.php +++ b/api/autoload.php @@ -23,4 +23,17 @@ require_once(__DIR__ . '/../inc/custom_fields.inc.php'); // Load the ApplicationContext $builder = new \DI\ContainerBuilder(); -$applicationContext = $builder->build(); \ No newline at end of file +$applicationContext = $builder->build(); + +// Fix for getallheaders() on PHP-FPM and nginx +if (!function_exists('getallheaders')) { + function 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; + } +} \ No newline at end of file