com php-src: Fixed bug #73594: ext/standard/dns.c ext/standard/tests/network/bug73594.phpt ext/standard/tests/network/bug73594a.phpt
| From: | Anatol Belski | Date: | Sun, 18 Dec 2016 19:44:33 +0000 |
| Subject: | com php-src: Fixed bug #73594: ext/standard/dns.c ext/standard/tests/network/bug73594.phpt ext/standard/tests/network/bug73594a.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96369@lists.php.net to get a copy of this message | ||
Commit: c78fd4568e24b8c68062be0f98163b5f45213bae
Author: Bruce Weirdan <weirdan@gmail.com> Fri, 25 Nov 2016 04:14:14 +0200
Committer: Anatol Belski <ab@php.net> Sun, 18 Dec 2016 20:44:33 +0100
Parents: c1af9f282f62eaf8a5973068ce373a800e0f752c
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c78fd4568e24b8c68062be0f98163b5f45213bae
Log:
Fixed bug #73594
Skip the tests when local resolver does not behave
* Added SKIPIF sections to check local resolver
* Added test to check $authns parameter
Bugs:
https://bugs.php.net/73594
Changed paths:
M ext/standard/dns.c
A ext/standard/tests/network/bug73594.phpt
A ext/standard/tests/network/bug73594a.phpt
Diff:
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index de40649..6cb518b 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -785,7 +785,7 @@ PHP_FUNCTION(dns_get_record)
int type, first_query = 1, store_results = 1;
zend_bool raw = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz!z!b",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz/!z/!b",
&hostname, &hostname_len, &type_param, &authns, &addtl, &raw) ==
FAILURE) {
return;
}
diff --git a/ext/standard/tests/network/bug73594.phpt b/ext/standard/tests/network/bug73594.phpt
new file mode 100644
index 0000000..a306836
--- /dev/null
+++ b/ext/standard/tests/network/bug73594.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #73594 (dns_get_record() does not populate $additional out parameter)
+--SKIPIF--
+<?php
+if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet
connection");
+
+$out = array();
+$ret = 0;
+exec("dig -tmx php.net +noall +additional 2>/dev/null", $out, $ret);
+
+if ($ret != 0) die("skip dig command is not present or failed to run");
+
+// skip empty and header lines
+$out = preg_grep("/^(?!($|;))/", $out);
+
+if (empty($out)) die("skip local resolver does not return additional records");
+?>
+--FILE--
+<?php
+$auth = array();
+$additional = array();
+dns_get_record('php.net', DNS_MX, $auth, $additional);
+var_dump(empty($additional));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/network/bug73594a.phpt b/ext/standard/tests/network/bug73594a.phpt
new file mode 100644
index 0000000..a0a08e4
--- /dev/null
+++ b/ext/standard/tests/network/bug73594a.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #73594 (dns_get_record() does not populate $additional out parameter - $authns parameter)
+--SKIPIF--
+<?php
+if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet
connection");
+
+$out = array();
+$ret = 0;
+exec("dig -tmx php.net +noall +authority 2>/dev/null", $out, $ret);
+
+if ($ret != 0) die("skip dig command is not present or failed to run");
+
+// skip empty and header lines
+$out = preg_grep("/^(?!($|;))/", $out);
+
+if (empty($out)) die("skip local resolver does not return authority records");
+?>
+--FILE--
+<?php
+$auth = array();
+dns_get_record('php.net', DNS_MX, $auth);
+var_dump(empty($auth));
+?>
+--EXPECT--
+bool(false)