|  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.
Block user comment
Status: Assign to:
Bug Type:
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, translates to 16820416 which, if fed into a browser in the form of:

http://16820416/ will attempt to connect to

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).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-15 06:35 UTC]
Fixed in CVS, please check.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 21 09:03:37 2023 UTC