1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 17:08:14 +02:00
Files
archived-php-src/ext/standard/tests/network/getmxrr.phpt
T
Nikita Popov 07cb665515 Fixed bug #80077
Quoting from the bug report:

> The domain names passed to getmxrr() do not contain a trailing dot.
> DNS lookups which do not find records will (depending on the local
> resolver config) try again by adding the local domain to the end of
> the searched host/domain. In many environments there's an mx record
> for any subdomain of the local domain and the MX query will return
> a hit. But the test expects no hit. So the test fails when checking
> that "qa.php.net" does not have an MX record in DNS. In our local
> environment the resolver falls back to also check qa.php.net.kippdata.de
> which does have an MX record. Using "qa.php.net." instead of "qa.php.net"
> should fix this for everyone.
2020-09-08 10:00:49 +02:00

29 lines
707 B
PHP

--TEST--
getmxrr() test
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip: no Windows support');
}
?>
--FILE--
<?php
$domains = array(
'mx1.tests.php.net.',
'mx2.tests.php.net.',
'qa.php.net.',
);
foreach ($domains as $domain) {
$result = getmxrr($domain, $hosts, $weights);
echo "Result: " . ($result ? "true" : "false")
. ", hosts: " . count( $hosts )
. ", weights: " . count( $weights ) . "\n";
}
?>
--EXPECT--
Result: true, hosts: 1, weights: 1
Result: true, hosts: 2, weights: 2
Result: false, hosts: 0, weights: 0