From 9a7cdbbe2d59518d83f04da726c821ced35ea663 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 26 Jul 2019 09:53:54 +0200 Subject: [PATCH] FIX Prevent undefined index notice when trying to determine HTTP_HOST during dev/build --- src/Model/Subsite.php | 2 +- src/Model/SubsiteDomain.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index 229604d..d3190bc 100644 --- a/src/Model/Subsite.php +++ b/src/Model/Subsite.php @@ -870,7 +870,7 @@ class Subsite extends DataObject } // If there are no objects, default to the current hostname - return $_SERVER['HTTP_HOST']; + return isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; } /** diff --git a/src/Model/SubsiteDomain.php b/src/Model/SubsiteDomain.php index 66432e9..a3aef03 100644 --- a/src/Model/SubsiteDomain.php +++ b/src/Model/SubsiteDomain.php @@ -185,7 +185,7 @@ class SubsiteDomain extends DataObject */ public function getSubstitutedDomain() { - $currentHost = $_SERVER['HTTP_HOST']; + $currentHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; // If there are wildcards in the primary domain (not recommended), make some // educated guesses about what to replace them with: