php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6159 ip2long returns a numeric address in network byte ordering
Submitted: 2000-08-14 20:45 UTC Modified: 2009-04-01 11:05 UTC
From: jjackson at vortech dot net Assigned:
Status: Closed Package: Network related
PHP Version: 4.0.1pl2 OS: Linux 2.2.16
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jjackson at vortech dot net
New email:
PHP Version: OS:

 

 [2000-08-14 20:45 UTC] jjackson at vortech dot net
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).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-15 06:35 UTC] stas@php.net
Fixed in CVS, please check.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 08:03:36 2021 UTC