Skip to content

Commit 168bdb7

Browse files
committed
Only match exact main and subdomains
1 parent 62bd050 commit 168bdb7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ExtractorFactory.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ public function createExtractor(UriInterface $uri, RequestInterface $request, Re
4646
$class = $this->default;
4747

4848
foreach ($this->adapters as $adapterHost => $adapter) {
49-
if (substr($host, -strlen($adapterHost)) === $adapterHost) {
49+
// Check if $host is the same domain as $adapterHost.
50+
if ($host === $adapterHost) {
51+
$class = $adapter;
52+
break;
53+
}
54+
55+
// Check if $host is a subdomain of $adapterHost.
56+
if (preg_match('/^([a-z0-9-]+)\.' . preg_quote($adapterHost, '/') . '$/i', $host, $matches)) {
5057
$class = $adapter;
5158
break;
5259
}

0 commit comments

Comments
 (0)