From 6ed11c40e8e948e219c68447f65094412e2dd3f5 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Sat, 16 Feb 2019 21:41:23 -0600 Subject: [PATCH] Don't check from CLI in Routes. Fixes #1724 --- system/Router/RouteCollection.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 4083ca39b156..2d8c4c8aa69f 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1250,7 +1250,7 @@ protected function create(string $verb, string $from, $to, array $options = null if (! empty($options['hostname'])) { // @todo determine if there's a way to whitelist hosts? - if (strtolower($_SERVER['HTTP_HOST']) !== strtolower($options['hostname'])) + if (isset($_SERVER['HTTP_HOST']) && strtolower($_SERVER['HTTP_HOST']) !== strtolower($options['hostname'])) { return; } @@ -1347,6 +1347,12 @@ protected function create(string $verb, string $from, $to, array $options = null */ private function checkSubdomains($subdomains) { + // CLI calls can't be on subdomain. + if (! isset($_SERVER['HTTP_HOST'])) + { + return false; + } + if (is_null($this->currentSubdomain)) { $this->currentSubdomain = $this->determineCurrentSubdomain();