diff options
author | Bruce Weirdan <weirdan@gmail.com> | 2016-11-25 04:14:14 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-12-18 20:44:33 +0100 |
commit | c78fd4568e24b8c68062be0f98163b5f45213bae (patch) | |
tree | 6d29479f9400165c4440312a6482cdf81e61a00f | |
parent | c1af9f282f62eaf8a5973068ce373a800e0f752c (diff) | |
download | php-git-c78fd4568e24b8c68062be0f98163b5f45213bae.tar.gz |
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
-rw-r--r-- | ext/standard/dns.c | 2 | ||||
-rw-r--r-- | ext/standard/tests/network/bug73594.phpt | 26 | ||||
-rw-r--r-- | ext/standard/tests/network/bug73594a.phpt | 25 |
3 files changed, 52 insertions, 1 deletions
diff --git a/ext/standard/dns.c b/ext/standard/dns.c index de40649e69..6cb518b301 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 0000000000..a3068360ce --- /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 0000000000..a0a08e4a9e --- /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) |