From: [EMAIL PROTECTED] Operating system: PHP version: 4.1.2 PHP Bug Type: Documentation problem Bug description: Associativity of assignment operators listed wrongly
The operators page at /manual/en/language.operators.php lists the the assignment operators (=, +=, etc.) as being left associative, but they must logically be right associative. Left associativity would mean that this: $a = $b = 0; was interpreted as: ($a = $b) =0; which is clearly nonsensical. Indeed a quick test shows that: $d = $c += $a += $b += 4; is interpreted as: $d = ($c += ($a += ($b += 4))); which looks like right associativity to me! (Actually, a little further testing suggests that the assignment operators need some special annotations, as they don't appear to strictly obey their stated precedence level. For example, the statement: $x = $z + $y = 543; if interpreted strictly according to the precedence rules should be equivalent to: $x = ($z + $y) = 543; which would be a parse error, but in fact is interpreted as: $x = $z + ($y = 543); which may be the "obvious" intention, but had me WTF-ing for a while!!) -- Edit bug report at http://bugs.php.net/?id=17386&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17386&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17386&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17386&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17386&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17386&r=support Expected behavior: http://bugs.php.net/fix.php?id=17386&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17386&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17386&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17386&r=globals