Bug #61188 [NEW]: Assignment changes order of evaluation of binop expression
| From: | antickon at gmail dot com | Date: | Sun, 26 Feb 2012 17:54:18 +0000 |
| Subject: | Bug #61188 [NEW]: Assignment changes order of evaluation of binop expression | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-167859@lists.php.net to get a copy of this message | ||
From:
Operating system: linux
PHP version: 5.3.10
Package: Variables related
Bug Type: Bug
Bug description:Assignment changes order of evaluation of binop expression
Description:
------------
An assignment expression can change the order of operation for == and !=
(and
possibly other binops)
Test script:
---------------
<?php
$a = 3;
var_dump( $a == ( $a = 4 ) );
Expected result:
----------------
bool(false)
evaluation of $a == ( $a = 4 ) should be as follows:
left side of the comparison is evaluated (evaluates to 3)
right side of the comparison is evaluated (4 is assigned to $a, evaluates
to 4)
3 == 4 finally evaluates to false
Actual result:
--------------
bool(true)
--
Edit bug report at https://bugs.php.net/bug.php?id=61188&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61188&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61188&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61188&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61188&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61188&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61188&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61188&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61188&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61188&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61188&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61188&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61188&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61188&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61188&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61188&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61188&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61188&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61188&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61188&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61188&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61188&r=mysqlcfg