#34601 [Opn->WFx]: Different code execution order than in previous PHP versions

From: Date: Thu, 22 Sep 2005 15:06:24 +0000
Subject: #34601 [Opn->WFx]: Different code execution order than in previous PHP versions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85451@lists.php.net to get a copy of this message
ID: 34601 Updated by: derick@php.net Reported By: steemann at globalpark dot de -Status: Open +Status: Wont fix Bug Type: Scripting Engine problem Operating System: Linux 2.4.21-99 PHP Version: 5.1.0RC1 New Comment: Although this is a BC break, you can never rely on this behavior in any computer language where you both *use* a variable and increment it. Previous Comments: ------------------------------------------------------------------------ [2005-09-22 16:50:06] steemann at globalpark dot de Description: ------------ I noticed a slight change in the order some instructions get executed. The execution order of instructions for a code like $result[$base]=$base++; differs from PHP 5.1 to previous versions so that the $result variable also has different values as follows: PHP 4.3.10 : array(1) { [0]=> int(0) } PHP 5.0.3 : array(1) { [0]=> int(0) } PHP 5.1.0b3 : array(1) { [1]=> int(0) } PHP 5.1.0RC1 : array(1) { [1]=> int(0) } Reproduce code: --------------- $base=0; $result[$base]=$base++; var_dump($result); Expected result: ---------------- To keep compatibility with PHP 4.x and 5.0.x: array(1) { [0]=> int(0) } Actual result: -------------- array(1) { [1]=> int(0) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34601&edit=1

« previous php.bugs (#85451) next »