ID:               47035
 Comment by:       valli at icsurselva dot ch
 Reported By:      valli at icsurselva dot ch
 Status:           Open
 Bug Type:         Network related
 Operating System: gentoo
 PHP Version:      5.2.8
 New Comment:

Here's my current workaround:

$rt = @dns_get_record($lookuphost, DNS_ANY);
// workaround for http://bugs.php.net/bug.php?id=47035
if (substr(PHP_VERSION,0,strpos(PHP_VERSION, '-')) == '5.2.8') {
    for($i = 0, $rts = sizeof($rt); $i < $rts; ++$i) {
        if ($rt[$i]['type'] == 'TXT') {
            // remove last byte
            $rt[$i]['txt'] = substr($rt[$i]['txt'], 0, -1);
        }
    }
}


Previous Comments:
------------------------------------------------------------------------

[2009-01-08 09:07:24] valli at icsurselva dot ch

Description:
------------
The last byte of a TXT record returned by dns_get_record
is garbage.


Reproduce code:
---------------
$rt = dns_get_record('82.19.186.195.countries.blackholes.us',
DNS_TXT);
$txt = $rt[0]['txt'];
print $txt." (".strlen($txt).")\n";
foreach(str_split($txt) as $char) {
    print "$char\t".ord($char)."\n";
}


Expected result:
----------------
ch (2)
c       99
h       104


Actual result:
--------------
ch (3)
c       99
h       104
        128



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47035&edit=1

Reply via email to