Skip to content
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

Avoiding issue when unable to add domain #885

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,11 @@ function encryptLoginEntry($login_password_cleartext)
// Get domain expiration date
function getDomainExpirationDate($name)
{

$nullValue = "1000-01-01";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 1 January 1970 00:00:00, the start of the current epoch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just took mySQL min date, but thats an easy change.

Preferable it should be nullable, but I have no clue of any potential issues in the codebase if the value is null. Just changed that few lines as it was stopping me from moving our docs :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know the domain portion of this tool enough to say exactly. I think utc 0 is fine for now.


// Only run if we think the domain is valid
if (!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
return "NULL";
return $nullValue;
}

$ch = curl_init();
Expand All @@ -390,14 +391,14 @@ function getDomainExpirationDate($name)
} elseif (isset($response['expiration_date'])) {
$expiry = new DateTime($response['expiration_date']);
} else {
return "NULL";
return $nullValue;
}

return $expiry->format('Y-m-d');
}

// Default return
return "NULL";
return $nullValue;
}

// Get domain general info (whois + NS/A/MX records)
Expand Down