Skip to content
Snippets Groups Projects
Commit 7934ef3a authored by Brook Schofield's avatar Brook Schofield
Browse files

Silence inet_pton

inet_pton failure is captured later - silence so unit tests pass.
parent 2a92b721
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ class Net ...@@ -20,7 +20,7 @@ class Net
* *
* @author Andreas Åkre Solberg, UNINETT AS <andreas.solberg@uninett.no> * @author Andreas Åkre Solberg, UNINETT AS <andreas.solberg@uninett.no>
* @author Olav Morken, UNINETT AS <olav.morken@uninett.no> * @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
* @author Brook Schofield, TERENA * @author Brook Schofield, GÉANT
* @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no> * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
*/ */
static function ipCIDRcheck($cidr, $ip = null) static function ipCIDRcheck($cidr, $ip = null)
...@@ -38,11 +38,11 @@ class Net ...@@ -38,11 +38,11 @@ class Net
// Validate IPv6 with inet_pton, convert to hex with bin2hex // Validate IPv6 with inet_pton, convert to hex with bin2hex
// then store as a long with hexdec // then store as a long with hexdec
$ip_pack = inet_pton($ip); $ip_pack = @inet_pton($ip);
$net_pack = inet_pton($net); $net_pack = @inet_pton($net);
if ($ip_pack === false || $net_pack === false) { if ($ip_pack === false || $net_pack === false) {
// not valid IPv6 address (warning already issued) // not valid IPv6 address (warning silenced)
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment