Closed Bug 513011 Opened 15 years ago Closed 6 years ago

"for each" loop iterating through elements in wrong order

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX
Q1 12 - Brannan

People

(Reporter: brbaker, Unassigned)

References

Details

Attachments

(1 file)

Attached file 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?
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
Flags: flashplayer-qrb? → flashplayer-qrb+
Target Milestone: --- → Future
Blocks: 563598
Priority: -- → P3
Target Milestone: Future → flash10.2
Flags: flashplayer-bug+
Whiteboard: must–fix-candidate
Whiteboard: must–fix-candidate → must-fix-candidate
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
Closed: 6 years 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.

Attachment

General

Creator:
Created:
Updated:
Size: