Bug #80792 [Com]: Test case bug73594.phpt fails even when dns_get_record() populates additional

[email protected] ("mjetzer dot cdc at gmail dot com")
Newsgroups php.bugs,php.qa
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=80792&edit=1

 ID:                 80792
 Comment by:         mjetzer dot cdc at gmail dot com
 Reported by:        simrit dot kaur at ibm dot com
 Summary:            Test case bug73594.phpt fails even when
                     dns_get_record() populates additional
 Status:             Open
 Type:               Bug
 Package:            Testing related
 Operating System:   SLES 12SP5
 PHP Version:        8.0.2
 Block user comment: N
 Private report:     N

 New Comment:

Also experiencing this with PHP 8.0.6 under RHEL-8.3.  I only searched for Bug #73594 because my investigation is pretty much the same as the original submitter.


Previous Comments:
------------------------------------------------------------------------
[2021-02-23 15:28:46] simrit dot kaur at ibm dot com

Description:
------------
For PHP v8.0.2, Test case "Bug #73594 (dns_get_record() does not populate $additional out parameter) [ext/standard/tests/network/bug73594.phpt]" failed on SLES 12SP5, s390x. 

I noticed that this TC is getting skipped on most distros for x86 and s390x due to one or the other SKIPIF reasons.
For my case, I took a tcpdump to confirm that DNS response had values in $additional. This was also confirmed by dig command but the TC is still failing..

"php > var_dump(!empty($res) && empty($additional));" is expected to return "bool(true)" but is returning "bool(false)". 
Please refer below snapshot for result of dig command and the Test case.. I can see that dns_get_record() is also returning value in $additional.
fyre@rotators1:~/php-8.0.2> php -a
Interactive shell

php > $ret = 0;
php > exec("dig -tmx php.net +noall +additional 2>/dev/null", $out, $ret);
php > var_dump($ret);
int(0)
php > $out = preg_grep("/^(?!($|;))/", $out);
php > var_dump($out);
array(26) {
  [0]=>
  string(44) "i.gtld-servers.net.       74061   IN      A       192.43.172.30"
  [1]=>
  string(43) "g.gtld-servers.net.       18269   IN      A       192.42.93.30"
  [2]=>
  string(43) "l.gtld-servers.net.       2876    IN      A       192.41.162.30"
  [3]=>
  string(43) "k.gtld-servers.net.       4222    IN      A       192.52.178.30"
.
.
.
  [25]=>
  string(52) "b.gtld-servers.net.       4042    IN      AAAA    2001:503:231d::2:30"
}
php >
php > $auth = array();
php > $additional = array();
php > $res = dns_get_record('php.net', DNS_MX, $auth, $additional);
php > var_dump(!empty($res) && empty($additional));
bool(false)
php > var_dump($res);
array(1) {
  [0]=>
  array(6) {
    ["host"]=>
    string(7) "php.net"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(30)
    ["type"]=>
    string(2) "MX"
    ["pri"]=>
    int(0)
    ["target"]=>
    string(21) "php-smtp4-ip4.php.net"
  }
}
php > var_dump($additional);
array(28) {
  [0]=>
  array(5) {
    ["host"]=>
    string(18) "i.gtld-servers.net"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(74061)
    ["type"]=>
    string(1) "A"
    ["ip"]=>
    string(13) "192.43.172.30"
  }
  [1]=>
  array(5) {
    ["host"]=>
    string(18) "g.gtld-servers.net"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(18269)
    ["type"]=>
    string(1) "A"
    ["ip"]=>
    string(12) "192.42.93.30"
  }
.
.
  [27]=>
  array(5) {
    ["host"]=>
    string(18) "i.gtld-servers.net"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(15164)
    ["type"]=>
    string(4) "AAAA"
    ["ipv6"]=>
    string(17) "2001:503:39c1::30"
  }
}
php >

Can you please give me a pointer to why this TC might be failing? Could this be a bug in the test case or in php code?

Test script:
---------------
To reproduce:
php -f php-8.0.2/ext/standard/tests/network/bug73594.phpt

OR

You can run this to check all values on php shell:

<?php
$ret = 0;
exec("dig -tmx php.net +noall +additional 2>/dev/null", $out, $ret);
var_dump($ret);
$out = preg_grep("/^(?!($|;))/", $out);
var_dump($out);

$auth = array();
$additional = array();
$res = dns_get_record('php.net', DNS_MX, $auth, $additional);
// only check $additional if dns_get_record is successful
var_dump(!empty($res) && empty($additional));
var_dump($res);
var_dump($additional);
?>


Expected result:
----------------
The Test case should pass.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80792&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.