"for each" loop iterating through elements in wrong order

RESOLVED WONTFIX

Status

P3
normal
RESOLVED WONTFIX
9 years ago
3 days ago

People

(Reporter: brbaker, Unassigned)

Tracking

unspecified
Q1 12 - Brannan
Bug Flags:
flashplayer-injection -
flashplayer-qrb +
flashplayer-bug +
flashplayer-triage +

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
Created attachment 397029 [details]
simple test

Steps to reproduce:
1. changing indexes - courtNumber makes "for each" to iterate through elements in wrong order. if the courtNumber were "1", "2", "6" - it is all right, but change it to "1", "3", "6" (like in example below) they will be in wrong order in for each loop. Change courtNumber to "1", "4", "6" and index "4" will be the first one in "for each" loop.

/* EXAMPLE 2 */

trace ("\n\nEXAMPLE 2");
var dataXml2:XML =<all>
<match_packet><stat courtNumber="1" /></match_packet>
<match_packet><stat courtNumber="3" /></match_packet>
<match_packet><stat courtNumber="6" /></match_packet>
</all>;

var scores2:Array = new Array();
if (dataXml2.localName() == "all") {
for each (var matchElement2a:XML in dataXml2.match_packet)
{
scores2[matchElement2a.stat.@courtNumber] = matchElement2a;
}
}

trace("For each loop:");
for each (var matchElement2b:XML in scores2)
{
debug.text += matchElement2b.stat.@courtNumber + "\n";
trace(matchElement2b.stat.@courtNumber);
}

trace("For loop:");
for (var i2:Number=0; i2 < scores2.length; i2++)
{
if (scores2[i2] != null)
{
trace(scores2[i2].stat.@courtNumber);
}
}



 
 Actual Results:
EXAMPLE 2
For each loop:
1
6
3
For loop:
1
3
6
 
 Expected Results:
EXAMPLE 2
For each loop:
1
3
6
For loop:
1
3
6
 
 
 Workaround (if any):
 use "for" loop not "for each".
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
(Reporter)

Comment 1

9 years ago
Transferred from JIRA ASC-3819 http://bugs.adobe.com/jira/browse/ASC-3819
Transferred comments: 

Brent Baker - [08/27/09 07:00 AM ]
$ java -jar $ASC -AS3 -import $BUILTINABC test.as
$ $AVM test.abc
For each loop:
1
6
3
For loop:
1
3
6


Brent Baker - [08/27/09 07:00 AM ] $ java -jar $ASC -AS3 -import $BUILTINABC test.as $ $AVM test.abc For each loop: 1 6 3 For loop: 1 3 6


Brent Baker - [08/27/09 07:08 AM ]
"for each" looping over the array "scores2" does not loop in the order that elements were added to the array.


Brent Baker - [08/27/09 07:08 AM ] "for each" looping over the array "scores2" does not loop in the order that elements were added to the array.


Brent Baker - [08/27/09 08:50 AM ]
This is not an injection, same output is produce using FP9 version of the shell

Updated

9 years ago
Flags: flashplayer-qrb? → flashplayer-qrb+
Target Milestone: --- → Future

Updated

9 years ago
Blocks: 563598

Updated

9 years ago
Priority: -- → P3
Target Milestone: Future → flash10.2

Updated

8 years ago
Flags: flashplayer-bug+
Whiteboard: must–fix-candidate

Updated

8 years ago
Whiteboard: must–fix-candidate → must-fix-candidate

Updated

8 years ago
Flags: flashplayer-injection-
Whiteboard: must-fix-candidate
Target Milestone: Q3 11 - Serrano → Q1 12 - Brannan
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Last Resolved: 3 days ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.