leth / PHP-IPAddress

IP Address utility classes for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent get_network_start / get_network_end Behavior

philipithomas opened this issue · comments

Compare these:

$foo = IP\NetworkAddress::factory("127.0.0.1");
$foo->get_cidr(); // 32
$foo->get_network_start(); // Null
$foo->get_network_end(); // Null

$bar = IP\NetworkAddress::factory("127.0.0.1/32");
$bar->get_cidr(); // 32
$bar->get_network_start(); // Not Null
$bar->get_network_start(); // Not Null

For consistent behavior - I think that the network start/end on a single IP should work the same as if it were loaded with a single address CIDR (i.e. 32 for IPv4).

I can work on the code for this, but I'm opening an issue for tracking.

Definitely looks like a bug! Thanks

Closing as per discussion in #21