tracker issue : CF-4126528

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

[ANeff] Bug for: ordered structs sort differently

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 03/09/2016

Components: Language

Versions: 2016

Failure Type: Unspecified

Found In Build/Fixed In Build: Alpha3_v12 /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Win All

Vote Count: 1

ordered structs sort differently (A comes after AA), but should sort the same as unordered structs (A comes before AA)

Repro:

<cfscript>
  unordered = {b=2, a=1, aa=1, c=3};
  
  ordered = structNew("ordered");
  ordered.b = 2;
  ordered.a = 1;
  ordered.aa = 1;
  ordered.c = 3;
  
  sortedDesc = unordered.sort("text", "desc");
  writeDump(sortedDesc);

  sortedDesc = unordered.sort(function(a1, a2) {
	  return sgn(a2-a1);
  });
  writeDump(sortedDesc);

  sortedDesc = ordered.sort("text", "desc");
  writeDump(sortedDesc);

  sortedDesc = ordered.sort(function(a1, a2) {
	  return sgn(a2-a1);
  });
  writeDump(sortedDesc);
</cfscript>

Actual result:
['C', 'B', 'AA', 'A']
['C', 'B', 'AA', 'A']
['C', 'B', 'A', 'AA']
['C', 'B', 'A', 'AA']

Expected result:
['C', 'B', 'AA', 'A']
['C', 'B', 'AA', 'A']
['C', 'B', 'AA', 'A']
['C', 'B', 'AA', 'A']

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

Watson Bug ID:	4126528

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email: adobelabs@itisdesign.com
External Test Config:

Attachments:

Comments:

Adding BUG AUDIT TRAIL ********action: updated fieldName: Reason newValue: NotABug oldValue: PRHaveInfo oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: Closed By newValue: suchsing oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: Owner newValue: Blank oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: State newValue: Closed oldValue: Open oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: Status newValue: Withdrawn oldValue: ToTrack oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: Date Closed newValue: 2015-11-25 02:52:31.0 oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-25 10:52:31.0 action: updated fieldName: State newValue: Open oldValue: Open oprid: prerelease recordName: RQ_DEFECT timpestamp: 2015-11-20 13:40:01.0 action: updated fieldName: Reason newValue: PRHaveInfo oldValue: PRNeedInfo oprid: prerelease recordName: RQ_DEFECT timpestamp: 2015-11-20 13:40:01.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTrack oprid: prerelease recordName: RQ_DEFECT timpestamp: 2015-11-20 13:40:01.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTest oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-20 12:39:23.0 action: updated fieldName: Reason newValue: PRNeedInfo oldValue: NotABug oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-20 12:39:23.0 action: updated fieldName: Owner newValue: suchsing oldValue: mchandna oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 15:57:20.0 action: updated fieldName: Reason newValue: NotABug oldValue: Investigate oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 15:57:20.0 action: updated fieldName: Status newValue: ToTest oldValue: ToFix oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 15:57:20.0 action: updated fieldName: Dev Assigned newValue: mchandna oldValue: awdhesh oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 11:09:06.0 action: updated fieldName: Owner newValue: mchandna oldValue: awdhesh oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 11:09:06.0 action: updated fieldName: Owner newValue: awdhesh oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 11:05:07.0 action: updated fieldName: Reason newValue: Investigate oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 11:05:06.0 action: updated fieldName: Status newValue: ToFix oldValue: Unverified oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 11:05:06.0 action: updated fieldName: Fix By Product Milestone newValue: Beta oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 11:05:06.0 action: updated fieldName: Fix By Milestone newValue: Beta oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 11:05:06.0 action: updated fieldName: QE Assigned newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:29.0 action: updated fieldName: Owner newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:29.0 action: added fieldName: Vote Type newValue: BETA oldValue: Blank oprid: prerelease recordName: AD_DEFECT_VOTE timpestamp: 2015-11-17 08:27:45.0
Comment by CFwatson U.
3848 | March 09, 2016 02:28:39 AM GMT
Form Errors: Vote comment is required and must be at least 25 characters in length.
Vote by External U.
3850 | March 09, 2016 02:28:41 AM GMT
Added By: PreRelease User User Name:Aaron Neff Note Added: Hi Adobe, This ticket can be closed. I was confused. Sorry! I've added an explanation here: https://prerelease.adobe.com/project/forum/post.html?cap=05d198f3b43f49ee950a8643486df6d4&forid={b099abd7-4284-4489-b8e2-839e0567f308}&topid={2ed78bf6-7cd8-48fb-ab94-adbfdcd35c30}&repid={C47912FA-21F9-4612-8298-675861B46AA7}&tp=2 Thanks!, -Aaron Date Added :2015-11-25 10:47:42.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Copying my comment from http://prerelease.adobe.com/r/?67be412c44ea4db6a2c7b3eab41c9244 (but please reply there, not here in this ticket): -------------------------------------------- But the callback isn’t the only issue. Please try this no-callback code: <cfscript> unordered = {b=2, a=1, aa=1, c=3}; ordered = structNew("ordered"); ordered.b = 2; ordered.a = 1; ordered.aa = 1; ordered.c = 3; unordered.sort("text", "desc");//returns [’C’, ’B’, ’AA’, ’A’] ordered.sort("text", "desc");//returns [’C’, ’B’, ’A’, ’AA’] </cfscript> See? Users will expect 2 structs having same keys/values to sort the same. Right? -------------------------------------------- Date Added :2015-11-20 13:40:01.0 Added By:suchsing Note Added: Given that the sort happens on value and two keys have the same value, there is no way to guarantee which key would come before in the sorted map. Hence it is not a bug. Changing the status to PRNeedInfo so that prerelease User gets the notification. Date Added :2015-11-20 12:39:25.0 Added By: PreRelease User User Name:Aaron Neff Note Added: The forum thread for this ticket is: http://prerelease.adobe.com/r/?67be412c44ea4db6a2c7b3eab41c9244 Please follow-up in that thread, not here in this ticket. Thanks!, -Aaron Date Added :2015-11-17 01:18:50.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Entered Bug. Date Added :2015-11-17 00:59:33.0
Comment by CFwatson U.
3849 | March 09, 2016 02:28:42 AM GMT