-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong expiration date detected #129
Comments
Somehow related to #123 |
Yep, they are related. It'd be nice to have a way to get only the first query result (thus, skipping this second query). I have a patch file for this. Are the maintainers interested in this? |
Checked. Now it's correct. Maybe previous parsing improvements fixed it.. |
Nope, that's not the reason. |
I solved this issue by patching php-whois version 3.5.0 (the version we are using) like this: From 4e88993de778be765624ab09f1bd42f05c6f295d Mon Sep 17 00:00:00 2001
From: Michele Locati <michele@locati.it>
Date: Tue, 15 Sep 2020 08:52:23 +0200
Subject: [PATCH] Allow skipping recursive whois
---
src/Iodev/Whois/Modules/Tld/TldModule.php | 22 +++++++++++++---------
src/Iodev/Whois/Whois.php | 5 +++--
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/src/Iodev/Whois/Modules/Tld/TldModule.php b/src/Iodev/Whois/Modules/Tld/TldModule.php
index d72a17a..c570744 100644
--- a/src/Iodev/Whois/Modules/Tld/TldModule.php
+++ b/src/Iodev/Whois/Modules/Tld/TldModule.php
@@ -122,30 +122,32 @@ class TldModule extends Module
/**
* @param string $domain
* @param TldServer $server
+ * @param bool $descend
* @return DomainResponse
* @throws ServerMismatchException
* @throws ConnectionException
* @throws WhoisException
*/
- public function lookupDomain($domain, TldServer $server = null)
+ public function lookupDomain($domain, TldServer $server = null, $descend = true)
{
$servers = $server ? [$server] : $this->matchServers($domain);
- list ($response) = $this->loadDomainData($domain, $servers);
+ list ($response) = $this->loadDomainData($domain, $servers, $descend);
return $response;
}
/**
* @param string $domain
* @param TldServer $server
+ * @param bool $descend
* @return DomainInfo
* @throws ServerMismatchException
* @throws ConnectionException
* @throws WhoisException
*/
- public function loadDomainInfo($domain, TldServer $server = null)
+ public function loadDomainInfo($domain, TldServer $server = null, $descend = true)
{
$servers = $server ? [$server] : $this->matchServers($domain);
- list (, $info) = $this->loadDomainData($domain, $servers);
+ list (, $info) = $this->loadDomainData($domain, $servers, $descend);
return $info;
}
@@ -169,11 +171,12 @@ class TldModule extends Module
/**
* @param string $domain
* @param TldServer[] $servers
+ * @param bool $descend
* @return array
* @throws ConnectionException
* @throws WhoisException
*/
- private function loadDomainData($domain, $servers)
+ private function loadDomainData($domain, $servers, $descend)
{
$this->lastUsedServers = [];
$domain = DomainHelper::toAscii($domain);
@@ -182,7 +185,7 @@ class TldModule extends Module
$lastError = null;
foreach ($servers as $server) {
$this->lastUsedServers[] = $server;
- $this->loadParsedTo($response, $info, $server, $domain, false, null, $lastError);
+ $this->loadParsedTo($response, $info, $server, $domain, false, null, $lastError, $descend);
if ($info) {
break;
}
@@ -201,10 +204,11 @@ class TldModule extends Module
* @param $strict
* @param $host
* @param $lastError
+ * @param bool $descend
* @throws ConnectionException
* @throws WhoisException
*/
- private function loadParsedTo(&$outResponse, &$outInfo, $server, $domain, $strict = false, $host = null, &$lastError = null)
+ private function loadParsedTo(&$outResponse, &$outInfo, $server, $domain, $strict = false, $host = null, &$lastError = null, $descend = true)
{
try {
$outResponse = $this->loadResponse($server, $domain, $strict, $host);
@@ -216,11 +220,11 @@ class TldModule extends Module
throw $lastError;
}
if (!$strict && !$outInfo) {
- $this->loadParsedTo($tmpResponse, $tmpInfo, $server, $domain, true, $host, $lastError);
+ $this->loadParsedTo($tmpResponse, $tmpInfo, $server, $domain, true, $host, $lastError, $descend);
$outResponse = $tmpInfo ? $tmpResponse : $outResponse;
$outInfo = $tmpInfo ?: $outInfo;
}
- if (!$outInfo || $host == $outInfo->getWhoisServer()) {
+ if (!$outInfo || $host == $outInfo->getWhoisServer() || !$descend) {
return;
}
$host = $outInfo->getWhoisServer();
diff --git a/src/Iodev/Whois/Whois.php b/src/Iodev/Whois/Whois.php
index 6ec78f2..3621807 100644
--- a/src/Iodev/Whois/Whois.php
+++ b/src/Iodev/Whois/Whois.php
@@ -93,14 +93,15 @@ class Whois
/**
* @param string $domain
+ * @param bool $descend
* @return DomainInfo
* @throws ServerMismatchException
* @throws ConnectionException
* @throws WhoisException
*/
- public function loadDomainInfo($domain)
+ public function loadDomainInfo($domain, $descend = true)
{
- return $this->getTldModule()->loadDomainInfo($domain);
+ return $this->getTldModule()->loadDomainInfo($domain, null, $descend);
}
/**
|
I'm still getting out of date expiries. In my case it was on the domain 'rsuttonart.org'. |
PHP-Whois version: 4.0.0
PHP version: 7.2.33
Description
The reported expiration for one of our domains (
progesoft-italia.com
) is wrong.From the control panel offered by our domain registration provider, we can read this:
(Sorry for Italian, it says that the domain expiration is
2021-07-22
)But this library says that the expiration is
2020-07-22
How to reproduce
Try the following code:
I'd expect it outputs
2021-07-22
, but it outputs2020-07-22
Possible Solution
I've seen that the library performs 2 queries, the first using
whois.verisign-grs.com
and the second usingwhois.register.it
Manually running those queries, we have:
As you can see,
whois.verisign-grs.com
returns2021-07-22
(the value we'd expect), whereaswhois.register.it
returns the value returned by this library.The text was updated successfully, but these errors were encountered: