Edit report at https://bugs.php.net/bug.php?id=80792&edit=1

 ID:                 80792
 Updated by:         c...@php.net
 Reported by:        simrit dot kaur at ibm dot com
 Summary:            Test case bug73594.phpt fails even when
                     dns_get_record() populates additional
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Testing related
 Operating System:   SLES 12SP5
 PHP Version:        8.0.2
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> "php > var_dump(!empty($res) && empty($additional));" is
> expected to return "bool(true)" but is returning "bool(false)". 

The test expectation was plain wrong, and that has recently been
fixed[1]; that fix is supposed to be available as of PHP 8.0.25
and 8.1.12.

[1] 
<https://github.com/php/php-src/commit/e6a822d437c4513fadcae69f0e8a233593a0b689>


Previous Comments:
------------------------------------------------------------------------
[2022-11-09 10:47:14] Pooja dot Shah at ibm dot com

Observed the same in PHP v8.1.11. Can someone take a look?

------------------------------------------------------------------------
[2021-06-01 16:18:17] mjetzer dot cdc at gmail dot com

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.

------------------------------------------------------------------------
[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

Reply via email to