Skip to content

Commit 44dee6a

Browse files
authored
Helpers: Add strtolower() for better scheme compatibility.
1 parent 1a7ba62 commit 44dee6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function getBaseUrl(): ?string
5757
*/
5858
public static function safeUrl(string $s): string
5959
{
60-
if (strncmp($s, 'http', 4) !== 0) {
60+
if (strncmp(strtolower($s), 'http', 4) !== 0) {
6161
$s = 'http://' . $s;
6262
}
6363

@@ -68,7 +68,7 @@ public static function safeUrl(string $s): string
6868
public static function parseDomain(string $url): string
6969
{
7070
$domainPattern = '/^(?:https?:\/\/)?(?<subdomain>[^\/]*?)(?<domain>localhost|(?:\d{1,3}\.?){4}|(?:(?:[a-z0-9-]+)\.(?:[a-z0-9-]+)))(?:\/|$)/';
71-
if (preg_match($domainPattern, $url, $parser)) {
71+
if (preg_match($domainPattern, strtolower($url), $parser)) {
7272
return (string) ($parser['domain'] ?? '');
7373
}
7474

0 commit comments

Comments
 (0)