Details
Description
Domain availability checks for .cl seem to always report the domain is available. The Generic Domains module uses the vendor library Iodev\Whois which references whois.nic.cl in the configuration in Blesta, which is the same as the current version of the library at https://github.com/io-developer/php-whois/blob/master/src/Iodev/Whois/Configs/module.tld.servers.json
I suspect there is a bug in this library, and it appears that perhaps the library is not being updated. There are some PR's.
This PR could potentially be related to the issue https://github.com/io-developer/php-whois/pull/209
I'm not sure what the solution is here even if we find the issue and resolve it, they may not merge in a PR. Do we need to fork it or use another library potentially?
Reported in Ticket #4008778
UPDATE
See attached investigation report. I think we need to fork the vendor code and update it ourselves.
FIX - APPEARS TO WORK
Fix #1: Add CLST Timezone Support
File: public_html/vendors/io-developer/php-whois/src/Iodev/Whois/Helpers/DateHelper.php
Location: Line 39 (before the return statement)
Add this code block:
} elseif (preg_match('/(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2}:\d{2})\s+(CLST|CLT)$/ui', $s, $m)) {
$s = "{$m[1]}T{$m[2]}";
}
Context: The code should look like this after the change:
} elseif (preg_match('/^(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2}:\d{2})\s+\(GMT([-+]\d+:\d{2})\)$/ui', $s, $m)) {
$s = "{$m[1]}T{$m[2]}{$m[3]}";
} elseif (preg_match('/(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2}:\d{2})\s+(CLST|CLT)$/ui', $s, $m)) {
$s = "{$m[1]}T{$m[2]}";
}
return (int)strtotime($s);
Fix #2: Update .CL TLD Configuration
File: public_html/vendors/io-developer/php-whois/src/Iodev/Whois/Configs/module.tld.servers.json
Location: Line 225
Change from:
{"zone": ".cl", "host": "whois.nic.cl"},
Change to:
{"zone": ".cl", "host": "whois.nic.cl", "parserType": "commonFlat"},
Fix #3: Allow Empty Domain Name Field
File: public_html/vendors/io-developer/php-whois/src/Iodev/Whois/Modules/Tld/TldInfo.php
Location: Line 125
Change from:
$primaryKeys = ['domainName'];
Change to:
$primaryKeys = []; // Allow empty domain name for TLDs like .cl
Issue investigation report