From:             mturner at cc dot umanitoba dot ca
Operating system: linux
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  Operator Pecedence

Description:
------------
According to the operator precdence docs, the modulus operator has
precedence over the equals operator.  But that is not in fact how it
works, as a recent thread on the php general list has shown.

Reproduce code:
---------------
$s= 5;
$d = 2;
$result = ($s % $d=3);
echo "3 incorrectly assigned to \$d:  \$d=$d\n";
echo "result of mod = $result\n";  //$result here is 2: 5 % 3


Expected result:
----------------
This should give an error, instead it assigns 3 to $d and gives a result
of 2.

A parallel bug was reported with respect to the ! and the = operators in
bug #17180, which resulted in a statement at the end of the operator
precedence document which allows for an exception to the rule. Either the
operator precedence rules should be respected or a general inquiry should
be made into how php handles = and a general statement about it should be
appended to the operator precedence docs.

These exceptions to the operator precedence rules are not allowd in Perl.


-- 
Edit bug report at http://bugs.php.net/?id=40820&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40820&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40820&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40820&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40820&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40820&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40820&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40820&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40820&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40820&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40820&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40820&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40820&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40820&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40820&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40820&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40820&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40820&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40820&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40820&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40820&r=mysqlcfg

Reply via email to