CFTHREAD, Names, and Commas

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#”> </code>

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#”> </code>

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 developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA