Raymond Camden's Blog Rss

CFTHREAD, Names, and Commas

1

Posted in ColdFusion | Posted on 05-18-2009 | 2,164 views

Just a quick note to warn folks. When using cfthread with a dynamic name, don't forget that commas are not allowed. Outside of that, you can use any name you want to for the thread, as long as it is non-empty. Here is a quick example:

view plain print about
1<cfthread name="-^p^-">
2thread
3</cfthread>
4
5<cfdump var="#cfthread#">

While that's a stupid name for a thread, it works just fine. Changing it to:

view plain print about
1<cfthread name="-^p^-,cow bell">
2thread
3</cfthread>
4
5<cfdump var="#cfthread#">

Gives you: Attribute validation error in the cfthread tag. The thread name -^P^-,COW BELL is invalid. Thread names cannot be empty and should not contain a comma.

In my case, the bug involved cfthread code being used in BlogCFC to handle pings. The blog title was used in naming the thread call and in this one example it had included a comma. (Kinda surprised this didn't come up before.)

So why does this restriction exist? When you use the JOIN action of cfthread, you are asked to provide a list of thread names. Because this list must always use a comma-delimited list of names, you can't, and shouldn't be able to, create a thread name that also includes a comma. I guess Adobe could add a DELIMITER attribute to the tag but that seems like overkill if you ask me.

Comments

[Add Comment] [Subscribe to Comments]

Perhaps the thread name needed even *more* cow bell?