Adobe ColdFusion 8

Using the Evaluate function

If your user-defined function uses the Evaluate function on arguments that contain strings, you must make sure that all variable names you use as arguments include the scope identifier. Doing so avoids conflicts with function-only variables.

The following example returns the result of evaluating its argument. It produces the expected results, the value of the argument, if you pass the argument using its fully scoped name, Variables.myname. However, the function returns the value of the function local variable if you pass the argument as myname, without the Variables scope identifier.

<cfscript>
    myname = "globalName";
    function readname(name) {
        var myname = "localName";
        return (Evaluate(name));
    }
</cfscript>

<cfoutput>
<!--- This one collides with local variable name. --->
    The result of calling readname with myname is: 
        #readname("myname")# <br>
<!--- This one finds the name passed in. --->
    The result of calling readname with Variables.myname is: 
        #readname("Variables.myname")# 
</cfoutput>