1

Possible Duplicate:
Common programming mistakes for ColdFusion programmer to avoid?

I just spent half the day troubleshooting what is apparently a rather famous gotcha for Coldfusion MX7 and below:

The nested query loop bug:

Where you are required to reference the current_row of the outer query or else you will only see the first record.

For example:

<cfloop query="outer">
  <cfloop query="innner">
    <p>#outer.field#</p><!--- this won't work, you'll only get the first row --->
    <p>#outer.field[current_row]#</p><!--- you must do this instead --->
  </cfloop>
</cfloop>

Are there any other ways in which ColdFusion does not work in the obvious way?

Community
  • 1
  • 1
jakeonrails
  • 1,885
  • 15
  • 37
  • I don't know that that's really a bug, and CF has worked that way for _ages_. It wasn't introduced in CF7. – ale Jun 23 '11 at 13:05

1 Answers1

4
  • Arrays are pass-by-value!
  • case-sensitive for certain ORM related operations / annotations
  • serializeJSON() may* mess up your data unexpectedly e.g.'yes' --> 'true', 1 --> 1.0
  • <cfdump> may not be telling you the truth
  • null and [empty string] is the same in a query object
  • CF9 doesn't support SOAP 1.2 very well, wait til CF10 arrives
  • some structs looks like structs, but they're not really struct (e.g. cfcatch )
  • remote methods will get invoked in a new instance of the containing CFC, so don't count on instance variables being ready to be used
  • var scope doesn't work as well as local. sometimes when it is defined multiple times in the same function
  • the ternary operator may evaluate your inline array/structure literal and throw exception if things inside that array/structure is not defined
  • <cfparam name="foo" default="#bar()#">, bar() is always invoked even though foo is defined
  • might accidentally run into undocumented reserved words: http://www.coldfusionjedi.com/index.cfm/2011/5/9/Interesting-issue-with-reserved-function-names-inside-CFCs
  • CF ajax tags and jQuery don't mix
  • more here: Common programming mistakes for ColdFusion programmer to avoid?
  • and even more here: Things to watch out for in ColdFusion 9 with CF-ORM
Community
  • 1
  • 1
Henry
  • 32,689
  • 19
  • 120
  • 221