TLDExtract icon indicating copy to clipboard operation
TLDExtract copied to clipboard

bug(Parser): incorrect result of getRegistrableDomain()

Open atypicalprogrammer opened this issue 8 years ago • 3 comments

This doesn't seem to work for any blogspot subdomain..

test.blogspot.com gives as registrable domain: test.blogspot.com

test.github.com gives as registrable domain: github.com

I don't understand how it would work that way?

atypicalprogrammer avatar Jan 27 '17 10:01 atypicalprogrammer

Hi @atypicalprogrammer

TLDExtract uses TLDDatabase which uses PublicSuffix List as single source of truth. PSL has two sections: ICANN and private domains. So, when you set TLDExtract's parsing mode it operates with determined sections.

blogspot.com is defined in private section, so it's private domain. If don't need private domains in your result, you need to set parsing mode:

$extract = new Extract(null, null, Extract::MODE_ALLOW_ICCAN);
$result = $extract->parse('test.github.com');
// of in fuction
tld_extract('test.github.com', Extract::MODE_ALLOW_ICCAN);

Howerer, I agree that getRegistrableDomain() returns an incorrect result without parsing options, it's a priority issue for next major version.

layershifter avatar Jan 27 '17 11:01 layershifter

hi,

there are also some other domains falsley valid. ex.: #test.com or test.com#test_test

->isValidDomain() gives me true for both, and also in the ->getRegistrableDomain() i get the false domain

regards

dgram avatar Jan 31 '17 00:01 dgram

@dgram Thanks, I opened #15 for this.

layershifter avatar Jan 31 '17 10:01 layershifter