After months of poring over CFCs for non-var'ed variables or other problems, I've finally solved the mysterious errors we've been getting on our production site at work with the help of Ray Camden's post "NPEs, onRequest, and other mysteries of the universe". If you have ever gotten intermittent ColdFusion errors with the message "null null" or "invalid query parameter binding" in lines of code that you know are correct, then you've run into this maddening problem.
Ray's blog refers to the experiences of one of his readers, who after seeing unpredictable null pointer errors in his site is advised by his web host's support tech to add a very basic onRequest function to his Application.cfm file. This problem sounded nearly identical to the one I've been tearing my hair out over for months (well, I stopped tearing my hair out over it and just started abiding with it months ago). I already had an onRequest function in my Application.cfc file, but I decided to mimic the one mentioned in Ray's post as closely as I could, so I added the <cfreturn /> call to my code. And do you know what? The errors stopped!
So if you've ever seen "null null" errors in your code, take a look at your onRequest. I don't know why this solution works, but I'm glad it does. Does anybody know why the NPE's happen, or why the inclusion of <cfreturn /> seems to solve them?

Comments (2)
March 25, 2008
14:16PM | #
the null null fix
http://kb.adobe.com/selfservice/viewContent.do?externalId=b3c51ba1&sliceId=1
March 25, 2008
14:32PM | #
@mgwalk: thanks for the link you posted, but it's to a hotfix for ColdFusion 6/MX. People are still getting null errors in ColdFusion 7, so unfortunately that solution won't work for everyone.