Skip to content
This repository was archived by the owner on Nov 20, 2019. It is now read-only.

underscore in hostname #25

Closed
Erwane opened this issue Apr 26, 2018 · 5 comments
Closed

underscore in hostname #25

Erwane opened this issue Apr 26, 2018 · 5 comments
Labels

Comments

@Erwane
Copy link
Contributor

Erwane commented Apr 26, 2018

Hi,

i've found a weird behavior in domain extraction;

$extract = new Extract();
$result = $extract->parse('dkim._domainkey.phea.fr');
print_r($result->toArray());

$result = $extract->parse('dkim.domainkey.phea.fr');
print_r($result->toArray());

result

Array
(
    [subdomain] => dkim._domainkey.phea
    [hostname] => fr
    [suffix] => 
)
Array
(
    [subdomain] => dkim.domainkey
    [hostname] => phea
    [suffix] => fr
)

the problem come from _ character.

this regex fix the problem

    const HOSTNAME_PATTERN = '#^((?!-)[a-z0-9_-]{0,62}[a-z0-9]\.)+[a-z]{2,63}|[xn\-\-a-z0-9]]{6,63}$#';
@LittlestFluffy
Copy link

LittlestFluffy commented May 15, 2018

We ran into a similar issue. Would be great if this could be fixed in a relatively short-term. For now we pinned the package onto v1.2.3 as temporary work-around to mitigate the issue.

@Erwane
Copy link
Contributor Author

Erwane commented May 25, 2018

@layershifter you need a PR ?

@layershifter
Copy link
Owner

@Erwane the PR with matching tests will be awesome 👍 Feel free to open it

@Erwane
Copy link
Contributor Author

Erwane commented Jun 19, 2018

PR #26

@layershifter
Copy link
Owner

@Erwane thanks, released as 1.2.5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants