tracker issue : CF-4198667

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

Operators not supported in evaluated expressions when inside #'s

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Abram Adams / Abram Adams ()

Created: 05/12/2017

Components: Language, Expressions

Versions: 2016,11.0

Failure Type: Others

Found In Build/Fixed In Build: 11,0,11,301867 (also in 2016) /

Priority/Frequency: Normal /

Locale/System: / Linux

Vote Count: 1

Problem Description:
When using operators such as <, <=, >, >= or == in an evaluated expression inside #'s it fails with an error.

Example code (also, see trycf.com examples below)
{code:java}
<cfscript>
// works in lucee & ACF
test = 1 < 2 ? false : true;

writeDump( test );

// fails in ACF (because <)
test2 = "#1 < 2 ? false : true#";
// test2 = "#1 lt 2 ? false : true#"; // <== this is the only way to make it work in ACF

writeDump( test2 );
</cfscript>
{code}


Steps to Reproduce:
run above sample code on ColdFusion 11
https://trycf.com/editor/gist/c82df4252b6c404ea1548e523b3c0cd9/acf11?theme=cobalt
Also fails on ColdFusion 2016
https://trycf.com/editor/gist/c82df4252b6c404ea1548e523b3c0cd9/acf2016?theme=cobalt

Actual Result:
Context validation error for the cfscript tag.

The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfscript>. If the body of the tag is empty, you can use the shortcut <cfscript .../>.

Expected Result:
For it to work.  Run this on Lucee for example
https://trycf.com/editor/gist/c82df4252b6c404ea1548e523b3c0cd9/lucee5?theme=cobalt

Any Workarounds:
One has to revert to the tag based operators such as lt/e, gt/e, eq

Attachments:

Comments:

An expression should just be an expression, and it should not matter in what context it is as to whether it's considered syntactically correct.
Vote by Adam C.
739 | May 12, 2017 03:13:44 PM GMT