ColdFusion cfinvokeargument bug

A coworker and I were debugging some old code yesterday and couldn’t believe what we came across. Say you have a component and and in a method for whatever reason you were using cfinvoke to call another method. In this case we have a variable called foo.result set to true. When this is passed to the method doSomething else what would you expect the value to be?

If you said true you and I are on the same page, but that isn’t the case. It turns out if you leaves the quotes off it will not try and evaluate the variable and just accepts it as a string so the result is…

That’s right, it treats it as a string. This to me seems like a bug as I would expect it to evaluate the variable there. An easy fix for this is to wrap it in ## with or without the quotes.

Categories: Random

About The Author

My name is Dan Vega and I am a Software Developer based out of Cleveland OH. I love to play with new technologies and write about my experiences here. When I am not busy being a full time geek I love to lift heavy weights and hang out with friends and family. If you have any questions please don't hesitate to contact me.

Follow me on: