php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51906 document that dns_get_record returns empty string on error
Submitted: 2010-05-25 18:18 UTC Modified: 2010-05-27 02:41 UTC
From: ksenzee at gmail dot com Assigned: degeberg (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
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: ksenzee at gmail dot com
New email:
PHP Version: OS:

 

 [2010-05-25 18:18 UTC] ksenzee at gmail dot com
Description:
------------
The documentation for dns_get_record says the return value is an array of associative arrays. It should also point out that if there is no DNS record for the domain being queried, it returns an empty string.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-27 01:52 UTC] degeberg@php.net
-Status: Open +Status: Feedback -Type: Bug +Type: Documentation Problem
 [2010-05-27 01:52 UTC] degeberg@php.net
I can't reproduce that. Could you give a script that results in that behavior along with the version of PHP you're using?

daniel@daniel-laptop:~$ cat test.php
<?php
var_dump(dns_get_record('fooaskljdalskdj.com'));
?>
daniel@daniel-laptop:~$ php -nv; php -n test.php
PHP 5.3.3-dev (cli) (built: May 23 2010 12:30:56) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
array(0) {
}
daniel@daniel-laptop:~$ src/php-5.2.13/sapi/cli/php test.php
array(0) {
}
 [2010-05-27 02:31 UTC] ksenzee at gmail dot com
Hm. I misread my log, so I was too hasty in my original report. What I should have said is that on *error*, dns_get_record returns FALSE and triggers a warning:

Warning: dns_get_record() [function.dns-get-record]: res_nsend() failed in ...

I can't provide a test script that reliably makes dns_get_record() error out. I'm assuming it depends on network conditions and the like.
 [2010-05-27 02:40 UTC] degeberg@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=299837
Log: Fixed PHP bug #51906, dns_get_record() returns false on failure.
 [2010-05-27 02:41 UTC] degeberg@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: degeberg
 [2010-05-27 02:41 UTC] degeberg@php.net
Ah, that makes more sense. It's been fixed now and should show up in the manual in a few days. Thanks for the report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 14:01:30 2024 UTC