Subversion Repositories php_utils

Compare Revisions

Regard whitespace Rev 45 → Rev 46

/trunk/ipv6_functions.inc.php
2,8 → 2,8
 
/*
* IPv6 functions for PHP
* Copyright 2012-2021 Daniel Marschall, ViaThinkSoft
* Version 2021-05-21
* Copyright 2012-2022 Daniel Marschall, ViaThinkSoft
* Version 2022-09-18
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
379,7 → 379,7
} else {
$rng = explode('-', $line);
$rng[0] = trim($rng[0]);
$rng[1] = trim($rng[1]);
if (isset($rng[1])) $rng[1] = trim($rng[1]);
$rng[0] = ipv6_normalize($rng[0]);
if (!isset($rng[1])) $rng[1] = $rng[0];
$rng[1] = ipv6_normalize($rng[1]);
452,12 → 452,7
 
// $bin = gmp_strval(gmp_init($ipv6long, 10), 2);
$bin = gmp_strval($ipv6long, 2);
if (strlen($bin) < 128) {
$pad = 128 - strlen($bin);
for ($i = 1; $i <= $pad; $i++) {
$bin = '0'.$bin;
}
}
$bin = str_pad($bin, 128, '0', STR_PAD_LEFT);
 
$bytes = 0;
$ipv6 = '';
724,10 → 719,7
$cache_bin2ip[$bin] = false;
return false;
}
$pad = 128 - strlen($bin);
for ($i = 1; $i <= $pad; $i++) {
$bin = '0'.$bin;
}
//$bin = str_pad($bin, 128, '0', STR_PAD_LEFT);
$bits = 0;
$ipv6 = ''; # added by vts to avoid warning
while ($bits <= 7) {