#20673 [NEW]: Inexplicable arithmetical error due to references
| From: | dakota at dir dot bg | Date: | Wed, 27 Nov 2002 13:04:52 +0000 |
| Subject: | #20673 [NEW]: Inexplicable arithmetical error due to references | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-25956@lists.php.net to get a copy of this message | ||
From: dakota@dir.bg
Operating system: Win 2000 NT
PHP version: 4.2.1
PHP Bug Type: Scripting Engine problem
Bug description: Inexplicable arithmetical error due to references
<?
$a = 7;
$a = $a + $a++;
echo $a;
//the result is 14;
?>
When I add a reference to $a, the behavior of $a + $a++ becomes
inexplicable different. Note that $a isn't changed anywhere!
<?
$a = 7;
$b =& $a;
$a = $a + $a++;
echo $a;
//the result is 15;
?>
The only difference is $b =& $a, but why $a takes care of references to
itself?
--
Edit bug report at http://bugs.php.net/?id=20673&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20673&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20673&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20673&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20673&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20673&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20673&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20673&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20673&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20673&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20673&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20673&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20673&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20673&r=isapi