php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72193 dns_get_record returns array containing elements of type 'unknown'
Submitted: 2016-05-11 09:00 UTC Modified: -
From: andremohren at gmail dot com Assigned:
Status: Closed Package: Network related
PHP Version: 7.0.6 OS: Windows 7
Private report: No CVE-ID: None
 [2016-05-11 09:00 UTC] andremohren at gmail dot com
Description:
------------
This function should return an array of associative arrays for each record, or false on failure. Somehow it may happen that the returned array contains elements of the type 'unknown' instead of 'array'. Running the same function on the same hostname multiple times shows that this problem seems to be random.

Whatever you try to do with the value results in an error. Printing it or using json_encode results in the script simply dying in my case.


Test script:
---------------
foreach (dns_get_record($hostname, DNS_A) as $record) {
    if (array_key_exists('host', $record)) {
        echo $record['host'] . "\n";
    }
}

Actual result:
--------------
Fatal error: Uncaught TypeError: array_key_exists() expects parameter 2 to be array, unknown given in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-11 09:32 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=df404e2e0eb190cd40f8f04a237cb9b655022148
Log: Fixed Bug #72193 (dns_get_record returns array containing elements of type 'unknown')
 [2016-05-11 09:32 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:31 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=df404e2e0eb190cd40f8f04a237cb9b655022148
Log: Fixed Bug #72193 (dns_get_record returns array containing elements of type 'unknown')
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC