|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27657 dns_get_record aborts script when domain has TXT record
Submitted: 2004-03-19 06:47 UTC Modified: 2004-03-24 03:11 UTC
From: wechsler at phase dot org Assigned:
Status: Closed Package: *Network Functions
PHP Version: 5.0.0RC1 OS: Linux version 2.4.18-bf2.4 (root
Private report: No CVE-ID: None
 [2004-03-19 06:47 UTC] wechsler at phase dot org
Use of function dns_get_record produces zero-length output when looking up any domain name that has an associated TXT record.

Tested with:,, (all have TXT record, zero data returned), (no TXT record, works OK)

Reproduce code:
/* code taken from
tested at:
header('Content-type: text/plain');
/* Request "ANY" record for,
   and create $authns and $addtl arrays
   containing list of name servers and
   any additional records which go with
   them */
$result = dns_get_record("", DNS_ANY, $authns, $addtl);
echo "Result = ";
echo "Auth NS = ";
echo "Additional = ";

Expected result:
DNS print_r output as at

Actual result:
Squid reports:

While trying to retrieve the URL:

The following error was encountered:

    * Zero Sized Reply 

Squid did not receive any data for this request. 

Equivalent response seen without proxy.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-19 06:53 UTC] wechsler at phase dot org
Bug engine has cropped OS data: full data as follows (based on Debian 3)

Linux version 2.4.18-bf2.4 (root@zombie) (gcc version 2.95.4 20011002 (Debian prerelease)) #1 Son Apr 14 09:53:28 CEST 2002

Full PHPinfo() for this server at
 [2004-03-19 06:55 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

I can't reproduce this. Does the webserver crash? (See your apache error log) If so, please generate a backtrace.
 [2004-03-23 13:41 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

This one was my fault.  The host environment supplies a value for "Maximum Hostname Length", but TXT records aren't hostnames.  They're just strings.

The patch (done several days ago at this point) will allocate memory for the record as needed now.  It should also run a bit quicker as I tidied things up while I was at it.
 [2004-03-24 03:11 UTC] wechsler at phase dot org
Looks good to me under php5-200403240730, thank you both for your help!
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 01:01:28 2019 UTC