#41373 [Opn]: Incorrect expression evaluation with pre-increment
ID: 41373
User updated by: romy4 at online dot ua
Reported By: romy4 at online dot ua
Status: Open
Bug Type: Scripting Engine problem
Operating System: WinNT,Linux
PHP Version: 5.2.2
New Comment:
i do not know how is php engine works inside but logically
++i should increment 'i' value by reference not copy of 'i' variable.
Previous Comments:
------------------------------------------------------------------------
[2007-05-12 13:45:34] romy4 at online dot ua
sorry, check what? i thought '++' has higher priority than '+' that
shown in the manual
(http://www.php.net/manual/ru/language.operators.php) or not at last
time?
------------------------------------------------------------------------
[2007-05-12 09:38:50] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The evaluation order of this construct is undefined and random things
may happen.
------------------------------------------------------------------------
[2007-05-12 08:41:56] itonix at inet dot ua
Very! VERY important bug
------------------------------------------------------------------------
[2007-05-12 08:33:05] romy4 at online dot ua
Description:
------------
PHP incorrectly evaluates code with variable pre-increment
Reproduce code:
---------------
$i=5;
$i=++$i + ++$i;
echo $i;
Expected result:
----------------
Expecting 14
Evaluated 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41373&edit=1
Thread (7 messages)