Bug #65343 [Com]: Not all DNS types supported in dns_get_record
Edit report at https://bugs.php.net/bug.php?id=65343&edit=1
ID: 65343
Comment by: daniil at daniil dot it
Reported by: info at tvdw dot eu
Summary: Not all DNS types supported in dns_get_record
Status: Analyzed
Type: Bug
Package: Network related
Operating System: any
PHP Version: 5.5.1
Block user comment: N
Private report: N
New Comment:
Raw mode can be used along with a DNS record parser to fetch DNS records of any type.
I've just created a small lib that does just this, if anyone's interested: https://github.com/danog/LibDNSNative
Previous Comments:
------------------------------------------------------------------------
[2013-07-26 23:20:12] yohgaki@php.net
This may be typed as bug.
------------------------------------------------------------------------
[2013-07-26 23:18:59] yohgaki@php.net
It seems PHP only supports following values.
php > array_walk(get_defined_constants(), function($v, $k) {if
(preg_match('/^DNS/', $k)) echo $k.' = '.$v.PHP_EOL;} );
DNS_A = 1
DNS_NS = 2
DNS_CNAME = 16
DNS_SOA = 32
DNS_PTR = 2048
DNS_HINFO = 4096
DNS_MX = 16384
DNS_TXT = 32768
DNS_SRV = 33554432
DNS_NAPTR = 67108864
DNS_AAAA = 134217728
DNS_A6 = 16777216
DNS_ANY = 268435456
DNS_ALL = 251713587
while there are
http://en.wikipedia.org/wiki/List_of_DNS_record_types
We are missing many.
------------------------------------------------------------------------
[2013-07-26 13:34:50] info at tvdw dot eu
Description:
------------
For a little project I'm working on I need DNS_DS (43) and DNS_TLSA (52) support in
dns_get_record, but these are currently not supported by PHP, together with a lot of other DNS
records. Manually defining these constants to the correct DNS RRtype values gives the warning
"dns_get_record(): Type .. not supported".
Test script:
---------------
<?php
$ds_record = dns_get_record('com', DNS_DS);
echo $ds_record['hash'];
Expected result:
----------------
E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CFC41A5766
Actual result:
--------------
Notice: Use of undefined constant DNS_DS - assumed 'DNS_DS' in ...
Warning: dns_get_record() expects parameter 2 to be long, string given in ...
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65343&edit=1
Thread (5 messages)