This one cost me an hour of my time this morning, and most of lunch. I can blame the earlier time on lack of coffee, but, wow, this was a dumb one.
I'm working on the ColdFusion Admin interface for Seeker, which is almost done by the way. From the list of Lucene indexes you can click to perform searches. This is handy when you want to build an index and then quickly test the results. I built out the UI and it basically came down to:
form code
if search has a value:
cf_search
dump results
end if
Whenever I entered a search term, however, the page would reload back to the home page for the CF Administrator. I thought perhaps it was a simple error, but no amount of try/catch or cferror would fix the issue.
I took my search custom tag and removed all the code and just did "hi" and even that wouldn't work. Yet the exact same code worked outside the CF Admin in a test file.
I then tried cfmodule instead of cf_search and it worked. It was at this point I took a closer look at my code...
<cfmodule template="/stuff/search.cfm" stuff>
and noticed my file name.... search.cfm.
My file was calling itself as a custom tag. -boggle- In my own defense, I've used cfmodule for so long I've gotten a bit rusty with cf_ syntax.
Archived Comments
Wow...I could see how that would take forever to debug!
I just finished up with one of those type of things yesterday. They always end up with the (only sometimes figurative) head-slap followed by the realization that you just burned many hours on your mistake.
Ray - Glad to see I'm not the only one who suffers from "too much blood in the caffeine stream" issues. Taught me to never write code before my first cup of coffee (sidenote: also - never write code after more than two good, single malt, scotches - grin)
Had a similar situation years ago at a former job. The common dev server that everyone used keep hanging 100% cpu. I asked everyone to tell me what they were working on so I could see what was causing the problem. Ended up going desk to desk and found that someone had made a page form.cfm and was trying to call a custom tag library that extended cfform call you guessed it cf_form. So had a recursive loop going and boom there goes the server.
I recently spent about 2hrs trying to figure out where in my code I was checking for malicious tags in textarea inputs that might make their way into the database, because it kept getting stored as InvalidTag - and I do have some checking going on, but couldn't figure out where that was coming from...
Then I did a search to see which 3rd party function I borrowed does that and came across one of your earlier posts... :)
http://www.coldfusionjedi.c...
For the last time, Raymond: come over the CFIMPORT camp. It's warm and safe here...
Heh, nice try there Nathan. ;)