You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
I finally got an opportunity to play some with cfcollection a month ago or so and ran into a small issue when dealing with collections that may have null keys. See this example:
var data = [ { 'foo' : 'bar', 'baz' : 'frobozz' }, { 'foo' : 'also bar', 'baz' : javacast( "null", "" ) } ];
var collection = wirebox.getInstance( name = "Collection@cfcollection", initArguments = { collection : data } );
dump( collection.toArray() );
Good so far!
But if you try this:
dump( collection.pluck( 'baz' ) );
It will throw:
Error: the value from key [baz] is NULL, which is the same as not existing in CFML (expression)
on Collection.cfc : 87 (ID: ??, Type: cfml)
Which is this line:
return item[ keys[ 1 ] ];
This works as a workaround:
return ( item[ keys[ 1 ] ] ?: '' );
Do you prefer a different solution or shall I submit that as a PR?
I finally got an opportunity to play some with cfcollection a month ago or so and ran into a small issue when dealing with collections that may have null keys. See this example:
Good so far!
But if you try this:
It will throw:
on Collection.cfc : 87 (ID: ??, Type: cfml)
Which is this line:
This works as a workaround:
Do you prefer a different solution or shall I submit that as a PR?