Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.0b4

Request #18687 support RFC5952 compatible format
Submitted: 2011-07-26 17:55 UTC
From: koyama Assigned: alexmerz
Status: Closed Package: Net_IPv6 (version 1.2.1)
PHP Version: 5.3.6 OS: CentOS
Roadmaps: (Not assigned)    
Subscription  


 [2011-07-26 17:55 UTC] koyama (Tetsuji Koyama)
Description: ------------ The new RFC5952, has established a recommended text representation of IPv6 address. The compress () output will conform to it almost a little different. In RFC5952 4.2.2, "The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field." I wrote new method for it.

Comments

 [2011-07-26 17:58 UTC] koyama (Tetsuji Koyama)
Uploading a patch is not working. paste here. --- IPv6.php 2011-07-26 20:38:19.000000000 +0900 +++ IPv6.php.new 2011-07-26 20:37:46.000000000 +0900 @@ -748,6 +748,32 @@ } // }}} + // {{{ recommendedFormat() + /** + * represent IPv6 address in RFC5952 format. + * + * @param String $ip a valid IPv6-adress (hex format) + * + * @return String the recommended representation of IPv6-adress (hex format) + * @access public + * @see compress() + * @static + * @author koyama at hoge dot org + */ + function recommendedFormat($ip) + { + $compressed = self::compress($ip, true); + // RFC5952 4.2.2 + // The symbol "::" MUST NOT be used to shorten just one + // 16-bit 0 field. + if ((substr_count($compressed, ':') == 7) && + (strpos($compressed, '::') !== false)) { + $compressed = str_replace('::', ':0:', $compressed); + } + return $compressed; + } + + // }}} // {{{ isCompressible() /**
 [2011-07-26 18:09 UTC] alexmerz (Alexander Merz)
-Assigned To: +Assigned To: alexmerz
 [2011-08-09 04:31 UTC] alexmerz (Alexander Merz)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.