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

[ErrorException] A non-numeric value encountered #77

Open
alglyzin opened this issue Nov 3, 2020 · 2 comments
Open

[ErrorException] A non-numeric value encountered #77

alglyzin opened this issue Nov 3, 2020 · 2 comments

Comments

@alglyzin
Copy link

alglyzin commented Nov 3, 2020

$res['y'] += 2000;

Using whois: artphone.co.il
Problem parse date for line: "domain-registrar AT isoc.org.il 20201019 (Assigned)"

photo_2020-11-03_17-57-49

@alglyzin
Copy link
Author

alglyzin commented Nov 3, 2020

Add whois.parser.php (function parseStandardDate())

    // EXAMPLE: domain-registrar AT isoc.org.il 20201019 (Assigned)
    $pattern = '/\s(\d{4})(\d{2})(\d{2})\s?|$/';
    if (preg_match_all($pattern, $date, $matches, PREG_SET_ORDER, 0) !== false) {
        $dateTimeFormat = 'Y-m-d';
        $date = "{$matches[0][1]}-{$matches[0][2]}-{$matches[0][3]}";
        $utc = new DateTimeZone('UTC');
        return Datetime::createFromFormat($dateTimeFormat, $date, $utc);
    }

@e7o-de
Copy link

e7o-de commented Mar 14, 2022

Got this message for the value

Updated Date: 0001-01-01T00:00:00.00Z

That "if value < 70" needs at least a is_numeric to prevent this error; better would be a null value returned for this kind of dates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants