Doc #71902 [NEW]: Invalid order of operators
| From: | vnd at vndh dot net | Date: | Fri, 25 Mar 2016 19:50:50 +0000 |
| Subject: | Doc #71902 [NEW]: Invalid order of operators | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-13346@lists.php.net to get a copy of this message | ||
From: vnd at vndh dot net
Operating system: N/A
PHP version: 5.6.19
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Invalid order of operators
Description:
------------
The array's value to key assignment operator "=>" priority is less than
the priority of operators "and", "xor" and "or". It can be verified by
the code attached to this issue. I also assume that this is
documentation problem as the priority of logical operators seems valid
in the mentioned context.
I've found two pages where the documentation is wrong:
1) http://php.net/manual/en/language.operators.assignment.php
states
that:
"The precedence of this operator is the same as other assignment
operators".
2) http://php.net/manual/en/language.operators.precedence.php
shows that
"=>" operator has the same priority as other assignment operators.
Test script:
---------------
// below expression should not evaluate nor be lexically valid when "=>"
has the priority over "and", "xor" or "or"
var_dump(array("a" => true and false xor false or false));
--
Edit bug report at https://bugs.php.net/bug.php?id=71902&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71902&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71902&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71902&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71902&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71902&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71902&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71902&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71902&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71902&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71902&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71902&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71902&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71902&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71902&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71902&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71902&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71902&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71902&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71902&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71902&r=mysqlcfg