EmailValidator icon indicating copy to clipboard operation
EmailValidator copied to clipboard

Use a safe way to execute dns_get_record (v2)

Open alies-dev opened this issue 4 years ago • 4 comments

Backport of the Use a safe way to execute dns_get_record (v3) #286


The idea is to create a custom error handler for dns_get_record(), call dns_get_record and then restore the original error handler. This way we can catch PHP warnings (e.g. "Warning: dns_get_record(): DNS Query failed" or "dns_get_record(): A temporary server error occurred." [ErrorException])

Tests

About failed tests: I think it’s not easily possible to test this case. Probably we can even remove a test I've added.

Also, I can't change Scrutinizer, it still tries to execute all tests

alies-dev avatar Feb 22 '21 08:02 alies-dev

Looks like everything above PHP7 is failing due to psalm errors.

egulias avatar Feb 28 '21 14:02 egulias

@egulias

Looks like everything above PHP7 is failing due to psalm errors.

exactly, but we can't use parameter types bc on v2 we support PHP >=5.5

e.g.: MissingClosureParamType - src/Validation/DNSCheckValidation.php:128:30 - Parameter $errorLevel has no provided type (see https://psalm.dev/153)

I would say it's psalm configuration issue, but I've just added suppression statement to "resolve" it: 06f4e8f

alies-dev avatar Mar 01 '21 08:03 alies-dev

Hey @egulias

what is the state of this PR review? Do you want something extra from me as from PR author?

alies-dev avatar Apr 04 '21 08:04 alies-dev

Hi @lptn , thanks for the heads up. I have had no time to check this one. I will review it shortly. I'll ping you if anything else is needed.

egulias avatar Apr 11 '21 13:04 egulias

Sorry, won't merge.

egulias avatar Jan 02 '23 17:01 egulias