Doc #78293 [Com]: Raw DNS resolving of MX records not supported
| From: | daniil at daniil dot it | Date: | Mon, 15 Jul 2019 12:31:13 +0000 |
| Subject: | Doc #78293 [Com]: Raw DNS resolving of MX records not supported | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16821@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
Comment by: daniil at daniil dot it
Reported by: daniil at daniil dot it
Summary: Raw DNS resolving of MX records not supported
Status: Closed
Type: Documentation Problem
Package: Network related
Operating System: Arch linux
PHP Version: 7.3.7
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Welp too late I saw you already edited that :)
Previous Comments:
------------------------------------------------------------------------
[2019-07-15 12:30:16] daniil at daniil dot it
I guess I was fooled by the fact that DNS_A is equal to 1, I guess I'll edit the docs then
------------------------------------------------------------------------
[2019-07-15 12:27:25] nikic@php.net
I've clarified the docs in https://github.com/php/doc-en/commit/cf08482c9e4db2497d51c4ff4acd8942e70a7b2f.
------------------------------------------------------------------------
[2019-07-15 11:20:54] nikic@php.net
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);
------------------------------------------------------------------------
[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