cvs: pear /Net_DNS/DNS/RR AAAA.php

From: Date: Fri, 08 Apr 2005 01:10:11 +0000
Subject: cvs: pear /Net_DNS/DNS/RR AAAA.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-31034@lists.php.net to get a copy of this message
ekilfoil Thu Apr 7 21:10:11 2005 EDT Modified files: /pear/Net_DNS/DNS/RR AAAA.php Log: Fixed bug #3236 with patch from mark at everytruckjob dot com http://cvs.php.net/diff.php/pear/Net_DNS/DNS/RR/AAAA.php?r1=1.1&r2=1.2&ty=u Index: pear/Net_DNS/DNS/RR/AAAA.php diff -u pear/Net_DNS/DNS/RR/AAAA.php:1.1 pear/Net_DNS/DNS/RR/AAAA.php:1.2 --- pear/Net_DNS/DNS/RR/AAAA.php:1.1 Tue May 6 14:04:28 2003 +++ pear/Net_DNS/DNS/RR/AAAA.php Thu Apr 7 21:10:10 2005 @@ -50,7 +50,7 @@ $this->rdata = $rro->rdata; if ($offset) { - $this->address = Net_DNS_RR_AAAA::ipv6_decompress(substr($this->rdata, 0, $this->rdlength)); + $this->address = Net_DNS_RR_AAAA::ipv6_decompress(substr($this->rdata, 0, $this->rdlength)); } else { if (strlen($data)) { if (count($adata = explode(':', $data, 8)) >= 3) { @@ -75,7 +75,7 @@ /* Net_DNS_RR_AAAA::rr_rdata($packet, $offset) {{{ */ function rr_rdata($packet, $offset) { - return Net_DNS_RR_AAAA::ipv6_compress($this->address); + return Net_DNS_RR_AAAA::ipv6_compress($this->address); } /* }}} */ @@ -112,18 +112,19 @@ /* Must be 8 shorts long */ return '::'; } - $a = unpack('n8b', $pack); - foreach($a as $idx => $value) - $a[$idx] = dechex($value); - $addr = implode(':', $a); - /* Shorthand the first :0:0:0: set into a :: */ + $a = unpack('n8', $pack); + $addr = vsprintf("%x:%x:%x:%x:%x:%x:%x:%x", $a); + /* Shorthand the first :0:0: set into a :: */ /* TODO: Make this is a single replacement pattern */ - if (substr($addr, -4, 4) == ':0:0') { + if (substr($addr, -4) == ':0:0') { return preg_replace('/((:0){2,})$/', '::', $addr); + } elseif (substr($addr, 0, 4) == '0:0:') { + return '0:0:'. substr($addr, 4); } else { - return preg_replace('/(:?(0:){2,})/', '::', $addr); + return preg_replace('/(:(0:){2,})/', '::', $addr); } } + /* }}} */ } /* }}} */

« previous php.pear.cvs (#31034) next »