Bug->Doc #78293 [Opn]: Raw DNS resolving of MX records not supported

From: Date: Mon, 15 Jul 2019 11:20:54 +0000
Subject: Bug->Doc #78293 [Opn]: Raw DNS resolving of MX records not supported
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16818@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78293&edit=1 ID: 78293 Updated by: nikic@php.net Reported by: daniil at daniil dot it Summary: Raw DNS resolving of MX records not supported Status: Open -Type: Bug +Type: Documentation Problem Package: Network related Operating System: Arch linux PHP Version: 7.3.7 Block user comment: N Private report: N New Comment: This is a case of bad docs... if raw mode is used, then you need to pass the raw DNS type ID (15 for MX). The DNS_* constants cannot be used (they are a bitmask, not a single type). The correct code is: echo ("\nRaw:\n"); var_dump(dns_get_record('daniil.it', 15, $auth, $add, true)); var_dump($auth, $add); Previous Comments: ------------------------------------------------------------------------ [2019-07-15 11:03:17] daniil at daniil dot it Description: ------------ When resolving MX records with the dns_get_record function, getting the raw record data isn't supported for some reason. Test script: --------------- <?php echo ("Normal:\n"); var_dump(dns_get_record('daniil.it', DNS_MX, $auth, $add, false)); var_dump($auth, $add); echo ("\nRaw:\n"); var_dump(dns_get_record('daniil.it', DNS_MX, $auth, $add, true)); var_dump($auth, $add) Expected result: ---------------- Normal: array(1) { [0]=> array(6) { ["host"]=> string(9) "daniil.it" ["class"]=> string(2) "IN" ["ttl"]=> int(300) ["type"]=> string(2) "MX" ["pri"]=> int(10) ["target"]=> string(13) "mx.yandex.net" } } NULL NULL Raw: array(1) { [0]=> array(6) { ["host"]=> string(9) "daniil.it" ["class"]=> string(2) "IN" ["ttl"]=> int(300) ["type"]=> int(16384) ["data"]=> string(X) "binary data representing MX record" } } NULL NUL Actual result: -------------- Normal: array(1) { [0]=> array(6) { ["host"]=> string(9) "daniil.it" ["class"]=> string(2) "IN" ["ttl"]=> int(300) ["type"]=> string(2) "MX" ["pri"]=> int(10) ["target"]=> string(13) "mx.yandex.net" } } NULL NULL Raw: array(0) { } NULL NUL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78293&edit=1

« previous php.doc.bugs (#16818) next »