Skip to content

Commit

Permalink
Merge pull request lxcenter#16 from shakaran/bugfix-926-master
Browse files Browse the repository at this point in the history
Fix bug #926: check empty values of ipaddr and more integrity checks
  • Loading branch information
dterweij committed Mar 3, 2012
2 parents 6af1b2e + 3bb11c9 commit 370c96b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions kloxo/httpdocs/htmllib/lib/linuxlib.php
Expand Up @@ -199,10 +199,17 @@ function getIPs_from_ifcfg()
$list = Ipaddress__Redhat::getCurrentIps();
}

foreach($list as $k => $v) {
if ($v['ipaddr'] === '127.0.0.1') { continue; };

$iplist[] = $v['ipaddr'];
$iplist = array(); // Initialize return value
if(!empty($list)) {
foreach($list as $k => $v) {
// Check ipaddr index
$ip_address = isset($v['ipaddr']) ? $v['ipaddr'] : NULL;

// Skip localhost IP or empty values
if ($ip_address !== '127.0.0.1' && !empty($ip_address)) {
$iplist[] = $ip_address;
}
}
}

return $iplist;
Expand Down
Expand Up @@ -208,7 +208,7 @@ static function getCurrentIps()
}
}

$result = "";
$result = array(); // Initialize as array (expected return result)

foreach($result1 as $res) {

Expand Down

0 comments on commit 370c96b

Please sign in to comment.