From:             [EMAIL PROTECTED]
Operating system: SuSE Linux 7.1
PHP version:      4.1.0
PHP Bug Type:     Scripting Engine problem
Bug description:  wrong bit arithmetics

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 bug report at: http://bugs.php.net/?id=14668&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to