CFTHREAD, Names, and Commas

This post is more than 2 years old.

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:

<cfthread name="-^p^-"> thread </cfthread>

<cfdump var="#cfthread#">

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

<cfthread name="-^p^-,cow bell"> thread </cfthread>

<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.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Ben Nadel posted on 5/18/2009 at 6:31 PM

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