Bug #14668 Updated: wrong bit arithmetics
| From: | yohgaki@php.net | Date: | Sat, 04 May 2002 04:13:42 +0000 |
| Subject: | Bug #14668 Updated: wrong bit arithmetics | ||
| References: | 1 | Groups: | php.bugs php.doc |
| Request: | Send a blank email to php-bugs+get-6887@lists.php.net to get a copy of this message | ||
ID: 14668
Updated by: yohgaki@php.net
Reported By: soletan@toxa.de
Status: Open
-Bug Type: Scripting Engine problem
+Bug Type: Documentation problem
Operating System: SuSE Linux 7.1
PHP Version: 4.1.0
New Comment:
Don't use ip2long/long2ip. It just dosen't work.
Do it by yourself with bcmath.
Manual page should clearly note the limitation.
Changed to doc problem to see if manual is ok.
Previous Comments:
------------------------------------------------------------------------
[2001-12-23 06:55:25] soletan@toxa.de
Hi,
using ip2long is strange enough itself (would you please
do some better description on what I get out after calling
this function or at least do some references to documents
(RFCs) describing that "IP address in full length
notation" format).
Anyhow: I'm coding the following
<?php
$a = base_convert( 0xFFFFFFFF ^ 1, 10 2 );
var_dump( $a );
?>
and get
string(2) "10"
(under 4.0.6 I got something different: 31 (!!!!) 1's in
string without that trailing 0)
what about all the other leading bits that should be 1?
And in relation with the ip2long-trouble I'm having:
<?php
$a = base_convert( ip2long( "255.255.0.255" ), 10, 2 );
$b = base_convert( ip2long( "255.255.0.255" ) ^
0xFFFFFFFF, 10, 2 );
var_dump( $a, $b );
?>
what gives me
string(16) "1111111100000001" string(16) "1111111100000000"
I beg to get some fast response! This behaviour of ip2long
and/or xor-operator is too strange to be easily understood
after reading that minimal function reference entry. But I
need it a lot for some work that needs to be done
urgently!!
Thank you very much!
Regards,
Thomas Urban
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14668&edit=1