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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andremohren at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 22:01:26 2024 UTC