Account for localhost/testing sites in domain checks
This commit is contained in:
parent
a6f62045c4
commit
4e652c91ae
@ -123,6 +123,10 @@ class Utils
|
|||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($result->hostname === 'localhost') {
|
||||||
|
return 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
// Couldn't validate a domain, see if this is an IP address?
|
// Couldn't validate a domain, see if this is an IP address?
|
||||||
if (filter_var($url, FILTER_VALIDATE_IP)) {
|
if (filter_var($url, FILTER_VALIDATE_IP)) {
|
||||||
return $url;
|
return $url;
|
||||||
|
@ -100,5 +100,6 @@ class UtilsTest extends TestCase
|
|||||||
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://phpvms.co.uk'));
|
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://phpvms.co.uk'));
|
||||||
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://www.phpvms.co.uk'));
|
$this->assertEquals('phpvms.co.uk', Utils::getRootDomain('http://www.phpvms.co.uk'));
|
||||||
$this->assertEquals('127.0.0.1', Utils::getRootDomain('http://127.0.0.1'));
|
$this->assertEquals('127.0.0.1', Utils::getRootDomain('http://127.0.0.1'));
|
||||||
|
$this->assertEquals('localhost', Utils::getRootDomain('http://localhost'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user