tracker issue : CF-4206196

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

Mishandling of local scope in inline higher order functions

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Mingo H. / ()

Created: 11/29/2019

Components: Language, Scopes

Versions: 2018

Failure Type: Non Functioning

Found In Build/Fixed In Build: 2018,0,06,316308 /

Priority/Frequency: Normal / Most users will encounter

Locale/System: / Windows 10

Vote Count: 0

When a closure inside a higher order function references a struct outside its own local scope, that struct's keys are not defined, yet the content of it is still usable. This differs from (for example) a simple value.

See below:

<cfscript>
function ex1() {
  var foo.bar = 'baz';
  var str = { 'test' = 1 };
  return str.map( function() {
    return isNull( foo.bar );
  } );
}

function ex2() {
  var foo = 'baz';
  var str = { 'test' = 1 };
  return str.map( function() {
    return isNull( foo );
  } );
}

writeOutput( '<br>' & serializeJSON( ex1() ) );   // {"test":true}
writeOutput( '<br>' & serializeJSON( ex2() ) );   // {"test":false}
writeOutput( '<br>' & server.coldfusion.productversion );
</cfscript>

There are more issues like this, also in ColdFusion 2016.

Attachments:

Comments: