#41470 [NEW]: referance assignment will cause unexpected side effect

From: Date: Wed, 23 May 2007 09:19:02 +0000
Subject: #41470 [NEW]: referance assignment will cause unexpected side effect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112951@lists.php.net to get a copy of this message
From:             xiezhenye at gmail dot com
Operating system: any
PHP version:      5.2.2
PHP Bug Type:     Scripting Engine problem
Bug description:  referance assignment will cause unexpected side effect

Description:
------------
after a referance assignment, the result of the expression will be an un
expected value.

Reproduce code:
---------------
<?php
$a = 1;
$c = ++$a+$a++;
echo $c; 
echo "\n";
$a = 1;
$b = &$a;
$c = ++$a+$a++;
echo $c; 
?>

Expected result:
----------------
4
4

Actual result:
--------------
4
5

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


Thread (2 messages)

« previous php.bugs (#112951) next »