A serious bug? "or" operator gives out diffferent results depending on order of operands

From: Date: Thu, 23 Dec 2004 19:26:35 +0000
Subject: A serious bug? "or" operator gives out diffferent results depending on order of operands
Groups: php.general 
Request: Send a blank email to php-general+get-205095@lists.php.net to get a copy of this message
Here's a little test script: -------------------- $x = 2; $y = 10; $b1 = is_null($x) or ($y > 5); $b2 = ($y > 5) or is_null($x); var_dump($b1); var_dump($b2); -------------------- Obviously, it should be false for both $b1 and $b2, but the output is: bool(false) bool(true) Is this a bug? I tried dumping values of two expressions, they are both boolean and correct value. Tried assigning values to two temp vars and then or-ing these two, and that gave correct results. I really cannot see what am I doing wrong. Tried this with php 4.3.2 and 4.3.9, and I get these weird results both times. Maybe I should herd cattle or something :) Boban. -- Please reply to the list and not to my email directly. I use usenet server and do not check yahoo email account.

« previous php.general (#205095) next »