#41237 [Com]: XOR problem
| From: | dochoncho at gmail dot com | Date: | Fri, 29 Feb 2008 21:53:52 +0000 |
| Subject: | #41237 [Com]: XOR problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122809@lists.php.net to get a copy of this message | ||
ID: 41237
Comment by: dochoncho at gmail dot com
Reported By: victorepand at gmail dot com
Status: No Feedback
Bug Type: Math related
Operating System: Linux
PHP Version: 5.2.1
New Comment:
Reproduced using PHP/5.2.3-1ubuntu6.3
What fun.
Previous Comments:
------------------------------------------------------------------------
[2007-08-29 09:22:22] php dot ydyoda at spamgourmet dot com
For information:
Same bug on PHP 4.3.11
But no probleme with PHP 4.3.5
------------------------------------------------------------------------
[2007-05-08 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-04-30 13:09:45] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2007-04-30 09:15:07] victorepand at gmail dot com
Description:
------------
I am finding a difference between the same bitwise arithmetic from one
server to the next when using PHP. What's more, this bitwise arithmetic
is necessary for the PHP script to run, so as a result it will only
function on one server, but not the other.
Here is an example I am using to demonstrate this:
if ((43814 ^ -4738698913)!=-443704711) print "incorrect result";
else print "correct result";
The (^) operator is an XOR bitwise arithmetic function as shown here:
http://us2.php.net/manual/en/language.operators.bitwise.php
and I am required to use numbers like the ones shown.
On one server, I have tried both PHP 4.4.0 and PHP 5.1.0RC1 and the
math works correctly for both (the correct answer as shown above is
-443704711). But on another server, I have tried the same math with both
PHP 4.4.6 and PHP 5.2.1, and it does not work correctly with either
version of PHP! The result I get at that server is: -2147439834.
I have no idea what could be the problem, but I can show you the PHP
Info for both servers and perhaps you can detect what might be the
difference?
Here is the PHP Info for the server that works correctly using PHP
5.1.0RC1:
http://www.buycellularphones.info/cron/special/info.php
Here is the PHP Info for the other server using PHP 5.2.1 that does not
work correctly:
http://www.customdesignpostcards.com/cron/special/info.php
Reproduce code:
---------------
if ((43814 ^ -4738698913)!=-443704711) print "incorrect result";
else print "correct result";
Expected result:
----------------
correct result
Actual result:
--------------
incorrect result
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41237&edit=1