Bug #63825 [NEW]: php dose not follow the operator precedence
| From: | rssidea at qq dot com | Date: | Fri, 21 Dec 2012 06:10:55 +0000 |
| Subject: | Bug #63825 [NEW]: php dose not follow the operator precedence | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-175518@lists.php.net to get a copy of this message | ||
From: rssidea at qq dot com
Operating system: all
PHP version: 5.3.20
Package: *Compile Issues
Bug Type: Bug
Bug description:php dose not follow the operator precedence
Description:
------------
By Operator Precedence on
http://php.net/manual/en/language.operators.precedence.php,
logical
operator '||'
is higher than assignment operator '=', so the script below should cause a
syntax
error.
Test script:
---------------
$a = $b = 0;
if ($a = 1 || $b = 1) {
echo $a;
}
Expected result:
----------------
execute as:
if ($a = (1 || $b) = 1) {
output:
syntax error, unexpected '='
Actual result:
--------------
execute as:
if ($a = (1 || ($b = 1))) {
output:
1
--
Edit bug report at https://bugs.php.net/bug.php?id=63825&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63825&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63825&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63825&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63825&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63825&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63825&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63825&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63825&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63825&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63825&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63825&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63825&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63825&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63825&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63825&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63825&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63825&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63825&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63825&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63825&r=mysqlcfg