From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.0.2 PHP Bug Type: Variables related Bug description: bitwise operators return different lengths
Description: ------------ If a biwise operator is applied on strings with different lengths one would expect that all such operators would return a string which length is a maximum of the lengths of the operands. Or at least that OR and XOR would do that. But neither is true since OR returns string having the maximum of both lengths and AND, XOR the minimum. That's why I think there is a bug in ^ operator. & operator may behave in both ways, although I would prefer the same behavior as in the case of | and ^. Reproduce code: --------------- echo bin2hex("\x01\x02" & "\x01\x00\x01\x02"),"\n"; echo bin2hex("\x01\x02" | "\x10\x20\x10\x00"),"\n"; echo bin2hex("\x01\x02" ^ "\x00\x00\x00\x01"),"\n"; Expected result: ---------------- 01000000 11221000 01020001 -- or -- 0100 11221000 01020001 Actual result: -------------- 0100 11221000 0102 -- Edit bug report at http://bugs.php.net/?id=30263&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30263&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30263&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30263&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30263&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30263&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30263&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30263&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30263&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30263&r=support Expected behavior: http://bugs.php.net/fix.php?id=30263&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30263&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30263&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30263&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30263&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30263&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30263&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30263&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30263&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30263&r=mysqlcfg