thecfguy

A Unique Developer

ColdFusion vs Railo behavior difference scope assignment.

While working with one of the project I have notice different behavior between ColdFusion and RAILO while using any scope as variable. I do not advise to use any CFML keywords/function name/scope name to use as variables although it doesn't complaining about it but as a human we do mistakes and we learn. Normally I have notice that people are using "url" as variable to store API url etc. But if you are working on website or project which support multiple platform then you may find behavior difference.

For below example, ColdFusion and RAILO return different output if I have use 'url' as local variables for function. For url and local.url return same value in ColdFusion but RAILO return URL struct in first case. I guess ColdFusion behavior is correct in this case since local variables take higher precedence over others.

RAILO:

Array
1
Scope
param1
string URL Parameter 1
param2
string URL Parameter 2
2
string http://www.thecfguy.com
Scope
param1
string URL Parameter 1
param2
string URL Parameter 2

 

ColdFusion

array
1 http://www.thecfguy.com
2 http://www.thecfguy.com
struct
PARAM1 URL Parameter 1
PARAM2 URL Parameter 2