fix: origin tests

This commit is contained in:
Chirag Aggarwal 2025-07-04 16:46:14 +05:30
parent df9ef1ace9
commit bc8b10a69e

View file

@ -42,12 +42,12 @@ class Origin extends Validator
$this->scheme = $this->parseScheme($origin);
$this->host = strtolower(parse_url($origin, PHP_URL_HOST) ?? '');
$validator = new Hostname($this->hostnames);
if (in_array($this->scheme, [Platform::SCHEME_HTTP, Platform::SCHEME_HTTPS]) && $validator->isValid($this->host)) { // Valid HTTP/HTTPS origin
return true;
if (in_array($this->scheme, [Platform::SCHEME_HTTP, Platform::SCHEME_HTTPS], true)) {
$validator = new Hostname($this->hostnames);
return $validator->isValid($this->host);
}
if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) { // Valid scheme-based origin
if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) {
return true;
}