Minor adjustment to ip validation variables.

This commit is contained in:
predominant 2010-04-24 10:51:56 +10:00
parent f65e481ebf
commit 557a6343f9

View file

@ -432,14 +432,14 @@ class Validation {
*/ */
public function ip($check, $type = 'both') { public function ip($check, $type = 'both') {
$type = strtolower($type); $type = strtolower($type);
$filterFlags = array(); $flags = array();
if ($type === 'ipv4' || $type === 'both') { if ($type === 'ipv4' || $type === 'both') {
$filterFlags[] = FILTER_FLAG_IPV4; $flags[] = FILTER_FLAG_IPV4;
} }
if ($type === 'ipv6' || $type === 'both') { if ($type === 'ipv6' || $type === 'both') {
$filterFlags[] = FILTER_FLAG_IPV6; $flags[] = FILTER_FLAG_IPV6;
} }
return (boolean)filter_var($check, FILTER_VALIDATE_IP, array('flags' => $filterFlags)); return (boolean)filter_var($check, FILTER_VALIDATE_IP, array('flags' => $flags));
} }
/** /**