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

Improve dns_get_record / dns_check_record error handling #17919

Open
bukka opened this issue Feb 24, 2025 · 1 comment
Open

Improve dns_get_record / dns_check_record error handling #17919

bukka opened this issue Feb 24, 2025 · 1 comment

Comments

@bukka
Copy link
Member

bukka commented Feb 24, 2025

Description

This is in relation to https://bugs.php.net/bug.php?id=73149 (with 142 up votes) which points problematic error handling of dns_get_record.

Due to BC break, this cannot be handled as a bug fix but there is a space to improve the error handling.

Firstly it would be useful to introduce parameter to switch the error handling to throw exception (e.g. bool $throw), that would allow throwing specialized exception which would allow to identify type of the error.

Additionally it might be also useful to add retry mechanism as some failures for TRY_AGAIN error.

@bukka
Copy link
Member Author

bukka commented Mar 1, 2025

I was just checking https://bugs.php.net/bug.php?id=70473 and it might be also useful to have a parameter to allow returning just the types that don't fail. In this case it might be actually better not to throw even if all types fail and rather return empty array as it was the case before. So maybe instead of throw it might make sense to introduce $error_mode parameter which could be an enum or constants like:

DNS_ERROR_MODE_THROW
DNS_ERROR_MODE_WARN
DNS_ERROR_MODE_IGNORE

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

No branches or pull requests

1 participant