#26464 [NEW]: ternary with multiple expression is boolean operator sensitive
| From: | php at jmvware dot com | Date: | Sat, 29 Nov 2003 16:13:47 +0000 |
| Subject: | #26464 [NEW]: ternary with multiple expression is boolean operator sensitive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-51340@lists.php.net to get a copy of this message | ||
From: php at jmvware dot com
Operating system: SunOS/Linux/Windows
PHP version: 4.3.2
PHP Bug Type: Unknown/Other Function
Bug description: ternary with multiple expression is boolean operator sensitive
Description:
------------
If the expression portion of the ternary operator is a mutliple comparison
expression the && operator does NOT return the same results as the AND
operator.
Reproduce code:
---------------
This works as expected:
$a=5;
$b=($a>1 && $a<10 ? 'yes' : 'no');
echo "$b<BR>";
// returns 'yes'
Note, using AND in place of &&
$a=5;
$b=($a>1 AND $a<10 ? 'yes' : 'no');
echo "$b<BR>";
// returns 1
--
Edit bug report at http://bugs.php.net/?id=26464&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26464&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26464&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26464&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26464&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26464&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26464&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26464&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26464&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26464&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26464&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26464&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26464&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26464&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26464&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26464&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26464&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26464&r=float