diff -aurN a/Net/IPv4.php b/Net/IPv4.php --- a/Net/IPv4.php 2010-09-08 06:31:50.000000000 -0400 +++ b/Net/IPv4.php 2017-08-04 14:57:52.872878217 -0400 @@ -32,7 +32,37 @@ * * @global array $GLOBALS['Net_IPv4_Netmask_Map'] */ -$GLOBALS['Net_IPv4_Netmask_Map'] = array( +$GLOBALS['Net_IPv4_Netmask_Map'] = Net_IPv4::$Net_IPv4_Netmask_Map; +// }}} +// {{{ Net_IPv4 + +/** +* Class to provide IPv4 calculations +* +* Provides methods for validating IP addresses, calculating netmasks, +* broadcast addresses, network addresses, conversion routines, etc. +* +* @category Net +* @package Net_IPv4 +* @author Eric Kilfoil +* @author Marco Kaiser +* @author Florian Anderiasch +* @copyright 1997-2005 The PHP Group +* @license http://www.php.net/license/3_01.txt PHP License 3.01 +* @version CVS: @package_version@ +* @link http://pear.php.net/package/Net_IPv4 +* @access public +*/ +class Net_IPv4 +{ + // {{{ properties + var $ip = ""; + var $bitmask = false; + var $netmask = ""; + var $network = ""; + var $broadcast = ""; + var $long = 0; +public static $Net_IPv4_Netmask_Map = array( 0 => "0.0.0.0", 1 => "128.0.0.0", 2 => "192.0.0.0", @@ -67,35 +97,6 @@ 31 => "255.255.255.254", 32 => "255.255.255.255" ); -// }}} -// {{{ Net_IPv4 - -/** -* Class to provide IPv4 calculations -* -* Provides methods for validating IP addresses, calculating netmasks, -* broadcast addresses, network addresses, conversion routines, etc. -* -* @category Net -* @package Net_IPv4 -* @author Eric Kilfoil -* @author Marco Kaiser -* @author Florian Anderiasch -* @copyright 1997-2005 The PHP Group -* @license http://www.php.net/license/3_01.txt PHP License 3.01 -* @version CVS: @package_version@ -* @link http://pear.php.net/package/Net_IPv4 -* @access public -*/ -class Net_IPv4 -{ - // {{{ properties - var $ip = ""; - var $bitmask = false; - var $netmask = ""; - var $network = ""; - var $broadcast = ""; - var $long = 0; // }}} // {{{ validateIP() @@ -154,7 +155,7 @@ */ function validateNetmask($netmask) { - if (! in_array($netmask, $GLOBALS['Net_IPv4_Netmask_Map'])) { + if (! in_array($netmask, self::$Net_IPv4_Netmask_Map)) { return false; } return true; @@ -264,7 +265,7 @@ */ function calculate() { - $validNM = $GLOBALS['Net_IPv4_Netmask_Map']; + $validNM = self::$Net_IPv4_Netmask_Map; if (! is_a($this, "net_ipv4")) { $myself = new Net_IPv4;