Highlighted

Am I the only one that thinks this is a bug in CF11?

New Here ,
Feb 19, 2016

Copy link to clipboard

Copied

I would love some feedback here from Adobe on whether or not this is a bug. If so, I will definitely report it but wanted to start here in the forums. Take a look at the cfscript code below:

array = [ {key1: "myKey"} ];

idx = 1;

tmp = array[idx];

writeDump( var=(array[1].key1 ?: ""), label="Prints 'myKey'" );

writeDump( var=(tmp.key1 ?: ""), label="Prints 'myKey'" );

writeDump( var=(array[idx].key1 ?: ""), label="Prints '[Empty String]'" );

The gist of what I am doing here is using the "elvis" operator to try and evaluate an object in realtime, and if the object cannot be evaluated, providing a default of an empty string. If you run this code, you will see that the first 2 methods of referencing array index 1 evaluate correctly and output my text but the 3rd does not. I realize that it would be better to check for the existence of a structure key explicitly but I am trying to use this approach for a massive refactor of some legacy code. It is stumping me as to why the 3rd method does not work so any input here would be greatly appreciated. As mentioned in the topic, I am using ColdFusion 11.

Thanks,

Micah

Views

561

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Am I the only one that thinks this is a bug in CF11?

New Here ,
Feb 19, 2016

Copy link to clipboard

Copied

I would love some feedback here from Adobe on whether or not this is a bug. If so, I will definitely report it but wanted to start here in the forums. Take a look at the cfscript code below:

array = [ {key1: "myKey"} ];

idx = 1;

tmp = array[idx];

writeDump( var=(array[1].key1 ?: ""), label="Prints 'myKey'" );

writeDump( var=(tmp.key1 ?: ""), label="Prints 'myKey'" );

writeDump( var=(array[idx].key1 ?: ""), label="Prints '[Empty String]'" );

The gist of what I am doing here is using the "elvis" operator to try and evaluate an object in realtime, and if the object cannot be evaluated, providing a default of an empty string. If you run this code, you will see that the first 2 methods of referencing array index 1 evaluate correctly and output my text but the 3rd does not. I realize that it would be better to check for the existence of a structure key explicitly but I am trying to use this approach for a massive refactor of some legacy code. It is stumping me as to why the 3rd method does not work so any input here would be greatly appreciated. As mentioned in the topic, I am using ColdFusion 11.

Thanks,

Micah

Views

562

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 19, 2016 0
Advocate ,
Feb 22, 2016

Copy link to clipboard

Copied

I cannot get the third item to work in CF11 update 7.

I tried variations in syntax, but they all fail.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2016 0
New Here ,
Feb 22, 2016

Copy link to clipboard

Copied

Thanks for testing and confirming the issue Eddie.

On Mon, Feb 22, 2016 at 12:27 PM, EddieLotter <forums_noreply@adobe.com>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2016 0
Adobe Employee ,
Feb 23, 2016

Copy link to clipboard

Copied

This is an issue in CF11 & we have fixed this for the latest version of ColdFusion i.e ColdFusion2016.

Thanks,

Suchika.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2016 0
Advocate ,
Feb 23, 2016

Copy link to clipboard

Copied

I assume this will be fixed for (still supported) CF11?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2016 0
New Here ,
Feb 23, 2016

Copy link to clipboard

Copied

@Suchsing,

Thanks for the response. As @haxtbh inquired below, when can we expect this

to be fixed in CF11?

Thanks,

Micah

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2016 0
Adobe Employee ,
Feb 24, 2016

Copy link to clipboard

Copied

There was a big implementation change that we did for elvis . We might not be pushing it for CF11.

Thanks,

Suchika.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 24, 2016 0
New Here ,
Feb 25, 2016

Copy link to clipboard

Copied

suchsing‌ - This could be a deal-breaker for my company. Can you send me a patch for CF11 or provide me a workaround that gives me the same functionality?

Thanks,

Micah

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 25, 2016 0
New Here ,
Mar 02, 2016

Copy link to clipboard

Copied

suchsing‌ - Can you send me a patch for CF11 for this bug? This is VERY important for me and I would greatly appreciate a response from you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2016 0
Adobe Employee ,
Mar 02, 2016

Copy link to clipboard

Copied

Back-porting the fix for CF 11 would not be possible as the underlying architecture was changed ... You may upgrade to ColdFusion 2016 to get the fix.

Thanks,

Suchika.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2016 0
LEGEND ,
Mar 03, 2016

Copy link to clipboard

Copied

The company that makes the Jive forum should install a DISLIKE button.

Is Adobe going to give jmicah‌ CF2016 for free?  Or at least a 95% discount??  Adobe has raised the price for CF to a ridiculous level.  If there is a known bug in CF11 and it was fixed for 2016 but not CF11, that could be perceived as extortion.

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 03, 2016 0
Most Valuable Participant ,
Feb 23, 2016

Copy link to clipboard

Copied

suchsing‌ Can you provide a Bugbase reference for that issue?

Thanks,

-Carl V.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2016 0
Adobe Employee ,
Feb 24, 2016

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 24, 2016 0