Bug #72193 [Opn->Csd]: dns_get_record returns array containing elements of type 'unknown'

From: Date: Wed, 11 May 2016 09:32:18 +0000
Subject: Bug #72193 [Opn->Csd]: dns_get_record returns array containing elements of type 'unknown'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201007@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72193&edit=1 ID: 72193 Updated by: laruence@php.net Reported by: andremohren at gmail dot com Summary: dns_get_record returns array containing elements of type 'unknown' -Status: Open +Status: Closed Type: Bug Package: Network related Operating System: Windows 7 PHP Version: 7.0.6 Block user comment: N Private report: N New Comment: 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') Previous Comments: ------------------------------------------------------------------------ [2016-05-11 09:00:30] 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 ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72193&edit=1

« previous php.bugs (#201007) next »