From owner-svn-ports-all@freebsd.org Thu Oct 27 09:27:46 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B000C22ED4; Thu, 27 Oct 2016 09:27:46 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07281166C; Thu, 27 Oct 2016 09:27:45 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R9RjLG002866; Thu, 27 Oct 2016 09:27:45 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R9RjMr002864; Thu, 27 Oct 2016 09:27:45 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201610270927.u9R9RjMr002864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Thu, 27 Oct 2016 09:27:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r424752 - in head/net/pear-Net_IPv6: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 09:27:46 -0000 Author: garga Date: Thu Oct 27 09:27:44 2016 New Revision: 424752 URL: https://svnweb.freebsd.org/changeset/ports/424752 Log: Import a patch to fix compress("::") calls Submitted by: Phil Davis Obtained from: https://github.com/phil-davis/Net_IPv6/commit/638b96a253164b65c63825c38e79812b6c5f448d MFH: 2016Q4 Sponsored by: Rubicon Communications (Netgate) Added: head/net/pear-Net_IPv6/files/patch-fix_compress (contents, props changed) Modified: head/net/pear-Net_IPv6/Makefile Modified: head/net/pear-Net_IPv6/Makefile ============================================================================== --- head/net/pear-Net_IPv6/Makefile Thu Oct 27 09:03:54 2016 (r424751) +++ head/net/pear-Net_IPv6/Makefile Thu Oct 27 09:27:44 2016 (r424752) @@ -3,7 +3,7 @@ PORTNAME= Net_IPv6 DISTVERSION= 1.3.0.b2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net pear DISTNAME= ${PORTNAME}-1.3.0b2 Added: head/net/pear-Net_IPv6/files/patch-fix_compress ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/pear-Net_IPv6/files/patch-fix_compress Thu Oct 27 09:27:44 2016 (r424752) @@ -0,0 +1,36 @@ +From 638b96a253164b65c63825c38e79812b6c5f448d Mon Sep 17 00:00:00 2001 +From: Phil Davis +Date: Thu, 27 Oct 2016 13:45:38 +0930 +Subject: [PATCH] Fix compress to "::" + +Problem: +``` +Net_IPv6::compress("0:0:0:0:0:0:0:0"); +``` +returns the empty string. + +It should return double-colon "::" + +The preg_replace here are over-zealous, in the "::" case, the sring +starts and ends with ":" and so both get stripped out. +--- + Net/IPv6.php | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/Net/IPv6.php b/Net/IPv6.php +index ba77472..39949d1 100644 +--- Net/IPv6.php ++++ Net/IPv6.php +@@ -734,8 +734,10 @@ public static function compress($ip, $force = false) + + } + +- $cip = preg_replace('/((^:)|(:$))/', '', $cip); +- $cip = preg_replace('/((^:)|(:$))/', '::', $cip); ++ if ($cip != "::") { ++ $cip = preg_replace('/((^:)|(:$))/', '', $cip); ++ $cip = preg_replace('/((^:)|(:$))/', '::', $cip); ++ } + + if ('' != $netmask) { +