PHP 4.0 Bug #6159: ip2long returns a numeric address in network byte ordering
| From: | jjackson at vortech dot net | Date: | Tue, 15 Aug 2000 00:45:44 +0000 |
| Subject: | PHP 4.0 Bug #6159: ip2long returns a numeric address in network byte ordering | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28875@lists.php.net to get a copy of this message | ||
From: jjackson@vortech.net
Operating system: Linux 2.2.16
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: ip2long returns a numeric address in network byte ordering
When using ip2long, it will return a int in network byte order, not host byte order. Although the
combination of ip2long and long2ip will work correctly together, the use of ip2long on an x86 system
will return a value that will not work as a URL.
For instance, 192.168.0.1 translates to 16820416 which, if fed into a browser in the form of:
http://16820416/ will attempt to connect to 1.0.168.192.
This also makes these functions useless on x86 systems for performing calculations of IP counts,
validations, broadcasts, etc. (which is the purpose that I am trying to use them for).