Bug #53360 [NEW]: wrong operator precedence
| From: | torkvemada at nigma dot ru | Date: | Fri, 19 Nov 2010 17:53:18 +0000 |
| Subject: | Bug #53360 [NEW]: wrong operator precedence | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-156231@lists.php.net to get a copy of this message | ||
From:
Operating system: any
PHP version: Irrelevant
Package: Scripting Engine problem
Bug Type: Bug
Bug description:wrong operator precedence
Description:
------------
According to documentation, comparison operators (like ==) have higher
priority than bitwise ones (like &).
However, the ==operator has higher precedence than &.
It was tested on Debian Squeeze (PHP 5.3.2-1 with Suhosin-Patch) and Debian
Lenny (PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2).
Test script:
---------------
$flag = 1;
var_dump($flag & 3 == 1);
var_dump(($flag & 3) == 1);
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
int(0)
bool(true)
--
Edit bug report at http://bugs.php.net/bug.php?id=53360&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53360&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53360&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53360&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53360&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53360&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53360&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53360&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53360&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53360&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53360&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53360&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53360&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53360&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53360&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53360&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53360&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53360&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53360&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53360&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53360&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53360&r=mysqlcfg