Permalink
Browse files

Fixed #16745

Fixed #16890


git-svn-id: http://svn.php.net/repository/pear/packages/Net_IPv4/trunk@301971 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
winks committed Aug 7, 2010
1 parent 2a2beaa commit d874e877bd1767d3c13390752b74efaddc715c31
Showing with 5 additions and 3 deletions.
  1. +5 −3 Net/IPv4.php
View
@@ -212,7 +212,7 @@ function parseAddress($address)
/*
* a hexadecimal string was entered
*/
- if (eregi("^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$", $parts[1], $regs)) {
+ if (preg_match("/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i", $parts[1], $regs)) {
// hexadecimal string
$myself->netmask = hexdec($regs[1]) . "." . hexdec($regs[2]) . "." .
hexdec($regs[3]) . "." . hexdec($regs[4]);
@@ -394,7 +394,7 @@ function atoh($addr)
*/
function htoa($addr)
{
- if (eregi("^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$",
+ if (preg_match("/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i",
$addr, $regs)) {
return hexdec($regs[1]) . "." . hexdec($regs[2]) . "." .
hexdec($regs[3]) . "." . hexdec($regs[4]);
@@ -436,7 +436,9 @@ function ipInNetwork($ip, $network)
if (! is_object($network) || strcasecmp(get_class($network), 'net_ipv4') <> 0) {
$network = Net_IPv4::parseAddress($network);
}
-
+ if (strcasecmp(get_class($network), 'pear_error') <> 0) {
+ return false;
+ }
$net = Net_IPv4::ip2double($network->network);
$bcast = Net_IPv4::ip2double($network->broadcast);
$ip = Net_IPv4::ip2double($ip);

0 comments on commit d874e87

Please sign in to comment.