php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80792 Test case bug73594.phpt fails even when dns_get_record() populates additional
Submitted: 2021-02-23 15:28 UTC Modified: 2022-11-09 12:53 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: simrit dot kaur at ibm dot com Assigned: cmb (profile)
Status: Closed Package: Testing related
PHP Version: 8.0.2 OS: SLES 12SP5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 - 8 = ?
Subscribe to this entry?

 
 [2021-02-23 15:28 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-01 16:18 UTC] 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.
 [2022-11-09 10:47 UTC] Pooja dot Shah at ibm dot com
Observed the same in PHP v8.1.11. Can someone take a look?
 [2022-11-09 12:53 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2022-11-09 12:53 UTC] cmb@php.net
> "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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC