Description:
------------
IP2Long does not handle leading zeroes
Reproduce code:
---------------
<?PHP
echo LONG2IP(IP2LONG('192.068.068.068'));
?>
OR
<?PHP
echo IP2LONG('192.068.068.068');
echo '<br>';
echo IP2LONG('192.68.68.68');
?>
Expected result:
----------------
Notice the top example should return back the same IP. The bottom example, should produce the same LONG number.

Patches

Pull Requests

History

That is expected.
"All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard (that is, a leading 0x or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise, the number is interpreted as decimal)."
- http://www.opengroup.org/onlinepubs/000095399/functions/inet_addr.html