Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2022 18:34:18 GMT
From:      Renato Botelho <garga@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 06920cf2b951 - main - net/pear-Net_IPv6: Fix for PHP < 8
Message-ID:  <202208161834.27GIYI35044314@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by garga:

URL: https://cgit.FreeBSD.org/ports/commit/?id=06920cf2b951f3d725bf4e582775dfa7086acd34

commit 06920cf2b951f3d725bf4e582775dfa7086acd34
Author:     Reid Linnemann <rlinnemann@netgate.com>
AuthorDate: 2022-08-16 18:31:35 +0000
Commit:     Renato Botelho <garga@FreeBSD.org>
CommitDate: 2022-08-16 18:34:09 +0000

    net/pear-Net_IPv6: Fix for PHP < 8
    
    Previously added patches use str_ends_with(), which is only available
    in php 8 and newer.  This commit adds to the patch a definition of
    str_ends_with() in the case it is undefined in an earlier version.
    
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D36219
---
 net/pear-Net_IPv6/Makefile                 |  2 +-
 net/pear-Net_IPv6/files/patch-Net_IPv6.php | 46 +++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/net/pear-Net_IPv6/Makefile b/net/pear-Net_IPv6/Makefile
index 8e48731d9b7d..51c687239c36 100644
--- a/net/pear-Net_IPv6/Makefile
+++ b/net/pear-Net_IPv6/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	Net_IPv6
 DISTVERSION=	1.3.0.b4
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net pear
 DISTNAME=	${PORTNAME}-1.3.0b4
 
diff --git a/net/pear-Net_IPv6/files/patch-Net_IPv6.php b/net/pear-Net_IPv6/files/patch-Net_IPv6.php
index 4f341704902c..1b2a62434afc 100644
--- a/net/pear-Net_IPv6/files/patch-Net_IPv6.php
+++ b/net/pear-Net_IPv6/files/patch-Net_IPv6.php
@@ -1,6 +1,26 @@
 --- Net/IPv6.php.orig	2022-08-11 20:00:46 UTC
 +++ Net/IPv6.php
-@@ -224,6 +224,27 @@ class Net_IPv6
+@@ -117,6 +117,19 @@ define("NET_IPV6_UNKNOWN_TYPE", 1001);
+ define("NET_IPV6_UNKNOWN_TYPE", 1001);
+ 
+ // }}}
++// {{{ compatability
++
++/* define str_ends_with() for php < 8 */
++if (! function_exists('str_ends_with')) {
++    function str_ends_with(string $haystack, string $needle): bool
++    {
++        $needle_len = strlen($needle);
++        return ($needle_len === 0 ||
++                substr_compare($haystack, $needle, - $needle_len) === 0);
++    }
++}
++
++// }}}
+ // {{{ Net_IPv6
+ 
+ /**
+@@ -224,6 +237,27 @@ class Net_IPv6
      }
  
      // }}}
@@ -28,7 +48,7 @@
      // {{{ getNetmaskSpec()
  
      /**
-@@ -324,6 +345,33 @@ class Net_IPv6
+@@ -324,6 +358,33 @@ class Net_IPv6
      }
  
      // }}}
@@ -62,7 +82,7 @@
      // {{{ isInNetmask()
  
      /**
-@@ -549,6 +597,8 @@ class Net_IPv6
+@@ -549,6 +610,8 @@ class Net_IPv6
  
          }
  
@@ -71,7 +91,7 @@
          $netmask = Net_IPv6::getNetmaskSpec($ip);
          $uip     = Net_IPv6::removeNetmaskSpec($ip);
  
-@@ -639,6 +689,12 @@ class Net_IPv6
+@@ -639,6 +702,12 @@ class Net_IPv6
              $uip = implode(':', $uipT);
          }
  
@@ -84,7 +104,7 @@
          if ('' != $netmask) {
  
                  $uip = $uip.'/'.$netmask;
-@@ -696,6 +752,9 @@ class Net_IPv6
+@@ -696,6 +765,9 @@ class Net_IPv6
  
          }
  
@@ -94,7 +114,7 @@
          $prefix = Net_IPv6::getPrefixLength($ip);
  
          if (false === $prefix) {
-@@ -709,7 +768,7 @@ class Net_IPv6
+@@ -709,7 +781,7 @@ class Net_IPv6
  
          }
          
@@ -103,7 +123,7 @@
          $ip = $split[0];
  
          $netmask = Net_IPv6::getNetmaskSpec($ip);
-@@ -750,9 +809,20 @@ class Net_IPv6
+@@ -750,9 +822,20 @@ class Net_IPv6
          }
  
          if ('' != $split[1]) { // add ipv4 part is available
@@ -126,7 +146,7 @@
          if ('' != $netmask) {
  
              $cip = $cip.'/'.$netmask;
-@@ -807,7 +877,7 @@ class Net_IPv6
+@@ -807,7 +890,7 @@ class Net_IPv6
      public static function isCompressible($ip)
      {
  
@@ -135,7 +155,7 @@
  
      }
  
-@@ -820,6 +890,9 @@ class Net_IPv6
+@@ -820,6 +903,9 @@ class Net_IPv6
       * RFC 2373 allows you to note the last two parts of an IPv6 address as
       * an IPv4 compatible address
       *
@@ -145,7 +165,7 @@
       * Example:  0:0:0:0:0:0:13.1.68.3
       *           0:0:0:0:0:FFFF:129.144.52.38
       *
-@@ -837,6 +910,7 @@ class Net_IPv6
+@@ -837,6 +923,7 @@ class Net_IPv6
       */
      public static function SplitV64($ip, $uncompress = true)
      {
@@ -153,7 +173,7 @@
          $ip = Net_IPv6::removeNetmaskSpec($ip);
  
          if ($uncompress) {
-@@ -853,10 +927,10 @@ class Net_IPv6
+@@ -853,10 +940,10 @@ class Net_IPv6
                  return array("", $ip);
              }
  
@@ -166,7 +186,7 @@
                  $ipPart[0] .= ":";
              }
  
-@@ -885,7 +959,6 @@ class Net_IPv6
+@@ -885,7 +972,6 @@ class Net_IPv6
       */
      public static function checkIPv6($ip)
      {
@@ -174,7 +194,7 @@
          $elements = Net_IPv6::separate($ip);
  
          $ip = $elements[0];
-@@ -1057,13 +1130,13 @@ class Net_IPv6
+@@ -1057,13 +1143,13 @@ class Net_IPv6
      protected static function _ip2Bin($ip)
      {
          $binstr = '';



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208161834.27GIYI35044314>