tracker issue : CF-4023966

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

Glitch in parsing of code using shorthand operator

| View in Tracker

Status/Resolution/Reason: To Fix//

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

Created: 07/22/2015

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 3

Full analysis: http://blog.adamcameron.me/2015/07/coldfusion-cfml-weird-shorthand.html

TL;DR:

Repro:

a = 17;
b = 19;
c = 23;

a += (b += c);

writeDump(variables);

Actual:
Invalid CFML construct found on line 8 at column 9.
ColdFusion was looking at the following text:
+=

Expected:
struct
A	59
B	42
C	23

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

Watson Bug ID:	4023966

External Customer Info:
External Company:  
External Customer Name: Adam
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Seems logical to me... and my pet monkey
Vote by External U.
6537 | July 22, 2015 09:05:20 AM GMT
The problem might lie outside of the multiple shorthand operators. Take a look at this code: a=1; b=2; c=3; // this fails a = (b += c); // this works a = b += c; The last line correctly assigns 5 to b and then assigns b to a.
Comment by External U.
6536 | July 22, 2015 09:42:12 AM GMT
I'm not sure what the outcome should be, but I do agree that the docs and behavior should be consistent.
Vote by External U.
6538 | July 22, 2015 09:44:32 AM GMT
+1 - I agree w/ the expected result and, IMO, the non-working shorthand expression in Nic's comment should match the working one.
Vote by External U.
6539 | July 22, 2015 07:03:01 PM GMT