tracker issue : CF-4126525

select a category, or use search below
(searches all categories and all time range)
Title:

Struct elements lost when sorting

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 03/09/2016

Components: Language

Versions: 2016

Failure Type: Unspecified

Found In Build/Fixed In Build: Alpha3_v12 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 1

Listed in the version 2016.0.03.300466 Issues Fixed doc
Repro:

sorted = structNew("sorted");
sorted.azure = "blue";
sorted.adze = "tool";
sorted.adam = "dork";
sorted.alabama = 3;
sorted = structNew("sorted", function(e1,e2){
    return e1.len() - e2.len();
});

Result:
adze: dork
azure: blue
alabama: 3

Note the "adam" element has disappeared.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4126525

External Customer Info:
External Company: Straker Interactive
External Customer Name: Adam Cameron
External Customer Email: CAMERON.ADAM@GMAIL.COM
External Test Config:

Attachments:

Comments:

Adding BUG AUDIT TRAIL ********action: updated fieldName: Priority newValue: 2 oldValue: 0 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 04:58:57.0 action: updated fieldName: Severity newValue: 2 oldValue: 3 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 04:58:57.0 action: updated fieldName: Reason newValue: Blank oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Date Closed newValue: null oldValue: 22-DEC-15 03.08.09.000000000 AM oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: State newValue: Open oldValue: Closed oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Status newValue: ToFix oldValue: Deferred oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Owner newValue: mchandna oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Closed By newValue: Blank oldValue: suchsing oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Date Deferred newValue: null oldValue: 22-DEC-15 03.08.09.000000000 AM oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:24:01.0 action: updated fieldName: Closed By newValue: suchsing oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Date Deferred newValue: 2015-12-22 03:08:09.0 oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Date Closed newValue: 2015-12-22 03:08:09.0 oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Owner newValue: Blank oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Fix By Milestone newValue: Alpha oldValue: Gold Master oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Status newValue: Deferred oldValue: ToTest oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: State newValue: Closed oldValue: Open oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Fix By Product Milestone newValue: Alpha oldValue: Gold Master oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Reason newValue: Blank oldValue: AsDesigned oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:08:09.0 action: updated fieldName: Owner newValue: suchsing oldValue: mchandna oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:05:49.0 action: updated fieldName: Status newValue: ToTest oldValue: ToFix oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:05:49.0 action: updated fieldName: Reason newValue: AsDesigned oldValue: BugVerified oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:05:49.0 action: updated fieldName: Fix By Milestone newValue: Gold Master oldValue: Beta oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-26 07:54:29.0 action: updated fieldName: Fix By Product Milestone newValue: Gold Master oldValue: Beta oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-26 07:54:29.0 action: updated fieldName: Owner newValue: mchandna oldValue: awdhesh oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:47:07.0 action: updated fieldName: Dev Assigned newValue: mchandna oldValue: awdhesh oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:47:07.0 action: updated fieldName: Reason newValue: BugVerified oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:46:55.0 action: updated fieldName: Status newValue: ToFix oldValue: Unverified oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:46:55.0 action: updated fieldName: Fix By Milestone newValue: Beta oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:46:55.0 action: updated fieldName: Fix By Product Milestone newValue: Beta oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:46:55.0 action: updated fieldName: Owner newValue: awdhesh oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 07:46:55.0 action: updated fieldName: QE Assigned newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:14.0 action: updated fieldName: Owner newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:14.0 action: added fieldName: Vote Type newValue: BETA oldValue: Blank oprid: prerelease recordName: AD_DEFECT_VOTE timpestamp: 2015-11-17 10:40:16.0
Comment by CFwatson U.
3857 | March 09, 2016 02:28:08 AM GMT
+1 - elements shouldn't vanish
Vote by External U.
3860 | March 09, 2016 02:28:10 AM GMT
Added By: PreRelease User User Name:Aaron Neff Note Added: Reminder: It should be StructNew('Ordered') Most CF developers will be confused by the word "Linked" b/c they do not know about Java's LinkedHashMap. They will think "linked to what?" And "what is my struct linked to?" Sorted structs can then be: StructNew("Ordered", "asc|desc") StructNew("Ordered", "asc|desc", "numeric,text,textnocase") StructNew("Ordered", comparator) Thus, ordered structs either have insertion order or sorted order. They're all "ordered". Thanks!, -Aaron Date Added :2016-01-09 00:38:21.0 Added By:suchsing Note Added: We are revisiting this implementation and so sorted structs have been removed from this version of ColdFusion. We have only StructNew(’Linked’) as of now. StructNew('Linked') would create a struct that maintains insertion order. Date Added :2015-12-22 11:29:12.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Reproduced w/ this: <cfscript> sorted = structNew("sorted", function(e1,e2){ return e1.len() - e2.len(); }); sorted.azure = "blue"; sorted.adze = "tool"; sorted.adam = "dork"; sorted.alabama = 3; writeDump(sorted); </cfscript> Date Added :2015-11-17 10:40:31.0 Added By: PreRelease User User Name:Adam Cameron Note Added: Entered Bug. Date Added :2015-11-17 08:40:24.0
Comment by CFwatson U.
3858 | March 09, 2016 02:28:11 AM GMT
Fix for this bug will available in the next update of ColdFusion 2016. For more information on the implementation of sorted structs , refer the latest documentation.
Comment by Suchika S.
3859 | September 19, 2016 01:41:49 AM GMT