所有PHP版本中的Xor bug [英] Xor bug in all PHP versions

查看:69
本文介绍了所有PHP版本中的Xor bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在linux服务器之间的大型签名双
上做了两个不同的结果。

工作系统是内核2.4。糟糕的结果服务器是内核2.6。


PHP版无所谓。我将PHP从4.2.2编译到最新。


测试代码:

<?PHP echo -4738698913 ^ 43814; ?>


结果:


2.4内核系统的良好结果是-443704711

2.6的错误结果内核系统(尝试了5种不同的系统)

-2147439834

PHP或内核中的BUG?

解决方案

2006年1月18日13:32:23 -0800,DigDug <做******* @ hotmail.com>写道:

我在Linux服务器之间的一个大型签名双重上做了两个不同的结果。
工作系统是内核2.4。糟糕的结果服务器是内核2.6。

PHP版无所谓。我将PHP从4.2.2编译到最新版本。

测试代码:
<?PHP echo -4738698913 ^ 43814; ?>

结果:

2.4内核系统的良好结果是-443704711
来自2.6内核系统(试过5种不同的系统)的不良结果是
-2147439834

PHP或内核的BUG?




32或64位架构?


您是否在
http://www.php.net/manual/en/languag...rs.bitwise.php ? (并非所有适用于

XOR,但有几个可能会让您感兴趣)。


-

Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space ::磁盘和FTP使用情况分析工具


< blockquote> DigDug写道:

我在Linux服务器之间的一个大型签名双重上做了两个不同的结果。


^运算符需要两个整数,所有按位运算符都可以。

工作系统是内核2.4。糟糕的结果服务器是内核2.6。

PHP版无所谓。我将PHP从4.2.2编译到最新版本。

测试代码:
<?PHP echo -4738698913 ^ 43814; ?>


<?php if(PHP_VERSION> ='''4.4.0'')echo PHP_INT_MAX; ?>


<?php echo var_dump(-4738698913); ?>


<?php echo -4738698913 | 0; ?>


<?php echo var_dump(-4738698913 | 0); ?>

结果:

2.4内核系统的良好结果是-443704711


64位机器?

来自2.6内核系统(试过5个不同系统)的错误结果是
-2147439834


32位机器?

BUG在PHP或内核中?




我认为也不是。


-

如果你通过Google发布阅读< http://cfaj.freeshell.org/google>


-4,738,698,913 ^ 43814 = -443,704,711如何正确?


I get two different results in doing a Xor on a large signed double
between linux servers.
working system is kernel 2.4 . bad results server is kernel 2.6.

PHP version does not matter. I compile PHP from 4.2.2 to latest.

test code:
<?PHP echo -4738698913 ^ 43814; ?>

results:

Good result from 2.4 kernel system is -443704711
Bad result from 2.6 kernel systems(tried 5 different systems) is
-2147439834

BUG in PHP or kernel?

解决方案

On 18 Jan 2006 13:32:23 -0800, "DigDug" <do*******@hotmail.com> wrote:

I get two different results in doing a Xor on a large signed double
between linux servers.
working system is kernel 2.4 . bad results server is kernel 2.6.

PHP version does not matter. I compile PHP from 4.2.2 to latest.

test code:
<?PHP echo -4738698913 ^ 43814; ?>

results:

Good result from 2.4 kernel system is -443704711
Bad result from 2.6 kernel systems(tried 5 different systems) is
-2147439834

BUG in PHP or kernel?



32 or 64 bit architecture?

Have you seen the related user notes on
http://www.php.net/manual/en/languag...rs.bitwise.php ? (Not all apply to
XOR but there are several in there that may interest you).

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


DigDug wrote:

I get two different results in doing a Xor on a large signed double
between linux servers.
The ^ operator takes two integers, all bitwise operator do.
working system is kernel 2.4 . bad results server is kernel 2.6.

PHP version does not matter. I compile PHP from 4.2.2 to latest.

test code:
<?PHP echo -4738698913 ^ 43814; ?>
<?php if (PHP_VERSION>=''4.4.0'') echo PHP_INT_MAX; ?>

<?php echo var_dump(-4738698913); ?>

<?php echo -4738698913 | 0; ?>

<?php echo var_dump(-4738698913 | 0); ?>
results:

Good result from 2.4 kernel system is -443704711
64-bit machine?
Bad result from 2.6 kernel systems(tried 5 different systems) is
-2147439834
32-bit machine?
BUG in PHP or kernel?



Neither, I think.

--
If you''re posting through Google read <http://cfaj.freeshell.org/google>


How is -4,738,698,913 ^ 43814 = -443,704,711 correct?


这篇关于所有PHP版本中的Xor bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆