php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52456 dns_get_record fourth parameter is not optional in 5.2
Submitted: 2010-07-27 15:17 UTC Modified: 2010-08-09 13:11 UTC
From: temp at umbrellasource dot com Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.14 OS: Centos 5.5
Private report: No CVE-ID: None
 [2010-07-27 15:17 UTC] temp at umbrellasource dot com
Description:
------------
There's some unexpected behavior to this function. According to documentation, the fourth parameter is optional. However, if you include the third parameter and omit the fourth, the function will error out with a warning. Either the documentation is wrong or this is a bug in 5.2. Given that it does 

This appears to be fixed as of 5.3.1 (tested on RHEL 6 beta)

Test script:
---------------
<?php
$ref = dns_get_record('php.net', DNS_A, $ns);
var_dump($ref);
?>

Expected result:
----------------
array(1) { [0]=>  array(5) { ["host"]=>  string(7) "php.net" ["type"]=>  string(1) "A" ["ip"]=>  string(13) "69.147.83.197" ["class"]=>  string(2) "IN" ["ttl"]=>  int(84264) } }

Actual result:
--------------
Warning: Wrong parameter count for dns_get_record()
NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-27 15:20 UTC] temp at umbrellasource dot com
Forgot to finish my thought

Given that it does work with the fourth parameter I'd just update the documentation that it does that in 5.2 and call it an undocumented feature.
 [2010-08-09 13:11 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=302030
Log: Fix doc bug #52456 (dns_get_record fourth parameter is not optional in 5.2).
 [2010-08-09 13:11 UTC] aharvey@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: aharvey
 [2010-08-09 13:11 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 09:00:01 2026 UTC