Skip to content

Commit

Permalink
Merge pull request #1732 from codeigniter4/routefix2
Browse files Browse the repository at this point in the history
Don't check  from CLI in Routes. Fixes #1724
  • Loading branch information
lonnieezell authored Feb 17, 2019
2 parents 0b6ebaa + 6ed11c4 commit 1d61fb2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 1d61fb2

Please sign in to comment.