views:

79

answers:

4

I have in my cfm something like this

<CFModule name="MyModule"
    someParam_one="#something.one#"
    someParam_two="#something.two#"
    someParam_etc="etc_etc_etc"/>

And inside my module, I have an

<CFSet param_name = "someParam_one">
...
evaluate("attributes." & param_name)

On most of our servers, this work. But on one of our servers, I get a

Error resolving parameter ATTRIBUTES.SOMEPARAM_NAME

Any ideas why?

Thanks

+1  A: 

A shot in the dark:

There's a bug in CFMX where if you make a CFMODULE call to a template (or use custom tag) from within a CFC and that tempate uses the CALLER scope to return data, the data is never available to the CFC function. This is bug 51067 and it is related to the VARIABLES scope bug, 45138.

Seen in the user comments in the CFMX 6 docs on CFMODULE.

Tomalak
Pardon for the very stupid quesiton,....but where is the the bug tracker for cfmx? ...it doesn't seem to show up in my google queries.
Franz See
And searching for bugs 51067 and 45138 in http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html retrieves nothing.
Franz See
It appears that the buck trackers may have become lost in the currents of the Macromedia to Adobe transition. I'm afraid I can't find them either. :-\
Tomalak
+3  A: 

Have you verified that someParam_one is actually getting created? I've found, for example, that if I do something like this:

<cfset foo = myObject.getSomething() />

and getSomething returns a void value or runs a Java function that doesn't return anything, that CF will choke on it. The variable will be "defined", or so the application seems to think, but attempting to access it will throw an error. So do the following to track down and catch the problem:

  1. Dump your attributes scope to make sure that what you want is indeed actually there.

  2. Run a StructKeyExists(Attributes, param_name) before attempting to access the variable.

  3. Get rid of the evaluate, and instead use Attributes[param_name]

Daniel Short
Yes, I would be curious to know what happens if you use array notation instead of evaulate ie Attributes[param_name].
Leigh
+2  A: 

Tangential to your question, but Evaluate() is evil, and an unnecessary evil in this situation. You can write this instead, and it will be more clear, more secure, and faster:

<cfset param_name = "someParam_one">
...
<cfset param_value = Attributes[param_name]>
Sixten Otto
+1  A: 

Ok, we did something really stupid :-)

We had two set of these files deployed and one was updated while the other was not, thus the error.

Thanks for all your help.

Franz See