TLDExtract
TLDExtract copied to clipboard
bug(Parser): incorrect result of getRegistrableDomain()
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?
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.
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 Thanks, I opened #15 for this.