mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
refactoring Validation::ip()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6755 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f96379ea36
commit
e7609469d4
1 changed files with 2 additions and 3 deletions
|
@ -530,13 +530,12 @@ class Validation extends Object {
|
|||
function ip($check) {
|
||||
$bytes = explode('.', $check);
|
||||
if (count($bytes) == 4) {
|
||||
$returnValue = true;
|
||||
foreach ($bytes as $byte) {
|
||||
if (!(is_numeric($byte) && $byte >= 0 && $byte <= 255)) {
|
||||
$returnValue = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $returnValue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue