#30689 [Bgs->Csd]: logical operators not working as expected
ID: 30689 User updated by: ioan dot nicu at ines dot ro Reported By: ioan dot nicu at ines dot ro -Status: Bogus +Status: Closed Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 4CVS-2004-11-04 (stable) New Comment: Sorry, you are right. I'm closing this bug report. Previous Comments: [2004-11-04 20:58:47] [EMAIL PROTECTED] No bug here, the = operator has a higher precedence than and, or and xor so you'll have to use parenthesis. See: http://www.php.net/manual/en/language.operators.php#language.operators.precedence [2004-11-04 18:54:14] ioan dot nicu at ines dot ro Description: The logical operators 'and', 'or', 'xor' have unexpected results. The bug doesn't occur when using C-style logical operators ( ||, &&, ^^). >From the php manual (Logical Operators Section): http://www.php.net/manual/en/language.operators.logical.php Example | Name | Result -- $a and $b | And | TRUE if both $a and $b are TRUE. $a or $b | Or | TRUE if either $a or $b is TRUE. $a xor $b | Xor | TRUE if either $a or $b is TRUE, but not both. This bug is reproducible on the latest stable snapshot from cvs. Reproduce code: --- Expected result: false or true = bool(true) true or false = bool(true) true and false = bool(false) false and true = bool(false) true xor true = bool(false) Actual result: -- false or true = bool(false) true or false = bool(true) true and false = bool(true) false and true = bool(false) true xor true = bool(true) -- Edit this bug report at http://bugs.php.net/?id=30689&edit=1
#30689 [NEW]: logical operators not working as expected
From: ioan dot nicu at ines dot ro Operating system: Linux PHP version: 4CVS-2004-11-04 (stable) PHP Bug Type: Zend Engine 2 problem Bug description: logical operators not working as expected Description: The logical operators 'and', 'or', 'xor' have unexpected results. The bug doesn't occur when using C-style logical operators ( ||, &&, ^^). >From the php manual (Logical Operators Section): http://www.php.net/manual/en/language.operators.logical.php Example | Name | Result -- $a and $b | And | TRUE if both $a and $b are TRUE. $a or $b | Or | TRUE if either $a or $b is TRUE. $a xor $b | Xor | TRUE if either $a or $b is TRUE, but not both. This bug is reproducible on the latest stable snapshot from cvs. Reproduce code: --- Expected result: false or true = bool(true) true or false = bool(true) true and false = bool(false) false and true = bool(false) true xor true = bool(false) Actual result: -- false or true = bool(false) true or false = bool(true) true and false = bool(true) false and true = bool(false) true xor true = bool(true) -- Edit bug report at http://bugs.php.net/?id=30689&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30689&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30689&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30689&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=30689&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=30689&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30689&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30689&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30689&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30689&r=support Expected behavior: http://bugs.php.net/fix.php?id=30689&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30689&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30689&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=30689&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30689&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=30689&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30689&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30689&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30689&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30689&r=mysqlcfg