#44892 [Opn->Bgs]: IP2LONG doesn't handle leading zeroes

From: Date: Fri, 02 May 2008 15:54:32 +0000
Subject: #44892 [Opn->Bgs]: IP2LONG doesn't handle leading zeroes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124662@lists.php.net to get a copy of this message
ID: 44892 Updated by: felipe@php.net Reported By: anthony dot morris at bankofamerica dot com -Status: Open +Status: Bogus Bug Type: Network related Operating System: Multiple PHP Version: 5.2.6 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2008-05-02 15:20:48] anthony dot morris at bankofamerica dot com 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44892&edit=1

« previous php.bugs (#124662) next »