php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80077 getmxrr test bug
Submitted: 2020-09-08 07:54 UTC Modified: 2020-09-08 08:00 UTC
From: rainer dot jung at kippdata dot de Assigned: nikic (profile)
Status: Closed Package: *Network Functions
PHP Version: 7.4.10 OS: Any
Private report: No CVE-ID: None
 [2020-09-08 07:54 UTC] rainer dot jung at kippdata dot de
Description:
------------
Test file ext/standard/tests/network/getmxrr.phpt was improved recently to also contain negative tests. See

https://github.com/php/php-src/commit/a06eed0c0ec03bdbb0f97aede393b5c687041d88

for the change in the main branch.

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.

Suggested trivial change for test improvement:

--- ext/standard/tests/network/getmxrr.phpt 2020-09-01 11:45:05.000000000 +0000
+++ ext/standard/tests/network/getmxrr.phpt 2020-09-08 09:51:14.436750929 +0000
@@ -11,9 +11,9 @@
 --FILE--
 <?php
 $domains = array(
-    'mx1.tests.php.net',
-    'mx2.tests.php.net',
-    'qa.php.net',
+    'mx1.tests.php.net.',
+    'mx2.tests.php.net.',
+    'qa.php.net.',
 );
 foreach ($domains as $domain) {
     $result = getmxrr($domain, $hosts, $weights);



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-08 08:00 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-09-08 08:01 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=07cb665515190be8319e77fa86d8f338c04e2c6b
Log: Fixed bug #80077
 [2020-09-08 08:01 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC