PHP-IPAddress
PHP-IPAddress copied to clipboard
Support for extra zeros like in ::factory("192.0.2.001" )
Trying to create an IP with extra zeros in ::factory("192.0.2.01") fails with "Unable to guess IP address type from '192.0.2.01'.". While that is a somewhat unconventional format, I would still expect it to work. I have seen some applications where textboxes for ip input will default to a format like 000.000.000.000.
This validation filter is defined by filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); we'd need to replace that function with an alternative. Once we're past the validation, it looks like ip2long will be okay with the data!