jeremykendall / php-domain-parser

Public Suffix List based domain parsing implemented in PHP
MIT License
1.16k stars 128 forks source link

Improve hostname validation #254

Closed nyamsprod closed 4 years ago

nyamsprod commented 4 years ago

https://github.com/jeremykendall/php-domain-parser/blob/100ca000612a4719ca9061250aaebd7ecc5feec8/src/IDNAConverterTrait.php#L250-L256

The regexp which is referred in the IDNAConverterTrait validates all registered name not just domain name. It should be changed to only validate domain names since the library is a domain name parser using the following regexp for basis:

https://github.com/thephpleague/uri-components/blob/master/src/Components/Host.php#L95-L113

This change might be view as a BC break as registered name which were valid before will now trigger an exception

@Shardj @jeremykendall thoughts ?

Insolita commented 4 years ago

This change may be very sensitive and depends on the library use case. I hope if you change default validation behavior, you also add fallback option for keep old-style validation.

nyamsprod commented 4 years ago

@Insolita that's is why I request input ? To know if this change must be done in the next major or not and if it is time for a new major ?

nyamsprod commented 4 years ago

this change will be postponed for the next major release 👍