structKeyArray()

The Lucee documentation states the following for structKeyArray():

For unsorted structs, Adobe returns a text sorted Array of keys, for performance reasons, Lucee simply returns the raw sort order

This statement is NOT correct.

Using the built-in cftry portion of the Lucee Docs

Shows that the returned array is indeed, sorted.

(Lucee 4.5, 5.4 and 6 - all return a sorted array.)

Either the documentation is wrong - or Lucee does not correctly implement its own spec.

2 Likes

Maybe some insights
https://luceeserver.atlassian.net/browse/LDEV-4725

1 Like

[deleted]

Indeed, and adding to the confusion in that doc page is the term “unsorted structs”, which should be “unordered structs”.

keep in mind, CFDUMP can be misleading, as it sorts on display

try serializeJson() or looping over the collection

1 Like

“AAAhhhh”
I didn’t know that cfdump automatically “sorts”.

IS there any value in me logging a ticket to change it?
To me - cfdump shouldn’t do anything like this - at least not implicitly.

but i’m thinking of maybe just annotating the display (sorted for display) like we do for ordered structs, as it’s nice being sorted after all, there is no guaranteed sort order otherwise and it will potentially change randomly

2 Likes