From c78fd4568e24b8c68062be0f98163b5f45213bae Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Fri, 25 Nov 2016 04:14:14 +0200 Subject: [PATCH] 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 --- ext/standard/dns.c | 2 +- ext/standard/tests/network/bug73594.phpt | 26 +++++++++++++++++++++++ ext/standard/tests/network/bug73594a.phpt | 25 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 ext/standard/tests/network/bug73594.phpt create mode 100644 ext/standard/tests/network/bug73594a.phpt 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-- +/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-- + +--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-- +/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-- + +--EXPECT-- +bool(false) -- 2.40.0