ID: 15380
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: ANY
PHP Version: 4.2.0-dev
Assigned To: derick
New Comment:
Actually, it's not a bug, but an undocumented feature.
What hapens is this:
When both operands are strings, the characters in those strings are
XORed like this:
result[0] = string1[0] ^ string2[0]
result[1] = string1[1] ^ string2[1]
For your example this is:
result[0] = '1' ^ '9'
which is:
#8 (the backspace character).
I'm fixing the documentation now.
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-02-27 07:49:25] [EMAIL PROTECTED]
Not critical, assinging to me to check it out.
------------------------------------------------------------------------
[2002-02-05 10:52:10] [EMAIL PROTECTED]
Some results (exactly the same with ZE1 and 2):
echo "12" ^ "9"; // output: nothing
echo "hello"."12" ^ "9"; // output: Q
echo "hello12" ^ "9"; // output: Q
echo "hello".("12" ^ "9"); // output: hell
Yes, that's hell and not hello!
------------------------------------------------------------------------
[2002-02-05 05:38:12] [EMAIL PROTECTED]
Verified with 4.2.0-dev. (ZE1)
This bug can make nasty bug in script that is really hard to find.
status = Critical
------------------------------------------------------------------------
[2002-02-05 04:54:00] [EMAIL PROTECTED]
Invalid Calculation when you make XOR operation between strings like:
"12" ^ "9".
It needs to change type from "String" => "Double"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15380&edit=1