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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-15 06:35 UTC] stas@php.net
Fixed in CVS, please check.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 16:01:31 2025 UTC