|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13835 long2ip gives wrong result/binary arithmatic does not work
Submitted: 2001-10-26 06:21 UTC Modified: 2001-10-26 06:57 UTC
From: corney at arco dot ru Assigned:
Status: Closed Package: Network related
PHP Version: 4.0.6 OS: FreeBSD 3.x, 4.x
Private report: No CVE-ID: None
 [2001-10-26 06:21 UTC] corney at arco dot ru
When I use long2ip or binary arithmetics  it's does not work correctly.
long2ip(3813441731) results where this result should be

when I'm trying to write analog of this function using binary arithmetics:

$ip = 3813441731;
$a = ($ip >> 24) & 0xff;
$b = ($ip >>16) & 0xff;
$c = ($ip >> 8) & 0xff;
$d = $ip & 0xff;
print "$a.$b.$c.$d";
I have same result:
What I do wrong?
I've try this on FreeBSD 3.5-STABLE, FreeBSD 4.2-RC2 and FreeBSD 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-26 06:57 UTC]
Works fins for me on Linux/FreeBSD 4.4 with PHP 4.1.0RC1 and PHP 4.2.0dev.
So it seems to be fixed. Can you try the RC from If it is not fixed there, please reopen this report.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 00:03:34 2021 UTC