From e3991543b2d5185adddf292846d4ba51e7abae02 Mon Sep 17 00:00:00 2001 From: 7twin <32747235+7twin@users.noreply.github.com> Date: Mon, 5 Nov 2018 22:45:34 +0100 Subject: [PATCH] Fixed not existing getallheaders() on PHP-FPM Thanks to https://web.archive.org/web/20181105214359/https://www.popmartian.com/tipsntricks/2015/07/14/howto-use-php-getallheaders-under-fastcgi-php-fpm-nginx-etc/ --- deploy.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deploy.php b/deploy.php index 0feeb4f..85f5bdc 100644 --- a/deploy.php +++ b/deploy.php @@ -164,6 +164,18 @@ function endScript() { // The branch $branch = ''; +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; + } +} + // Process request headers $headers = getallheaders(); if(isset($headers['X-Event-Key'])) {