bug with top leveldomains script
mwebber92 opened this issue · comments
Hi All,
I experience a bug when i try to manually run the script for top level domains with latest https://data.iana.org/TLD/tlds-alpha-by-domain.txt
It seems that this file doesn't work anymore with explode(PHP_EOL, $topLevelDomains)
and returns plain string instead of array...
and later
if (!is_array($topLevelDomains)) { die('Unable to parse domains'); }
doesn't stop, because result is empty array (from array_shift($topLevelDomains);
)
Can i suggest we just replace explode(PHP_EOL, $topLevelDomains)
with preg_split('/\r\n|\r|\n/', $topLevelDomains);
?
I have tested and this approach works correctly for mе.
Thanks