ColdFusion, WordPress, Flash & other web things


toString function on XML docs

Here is something worth knowing if you are hosting a CF site on a shared server with sandbox security.

Today, after one full day of 1 Pixel Out being live, the RSS feed page started throwing an error for no apparent reason. The feed is generated dynamically from the list of recent entries stored in the application scope. My RSS generator method builds an XML document and uses the toString() CF function to convert it to a string. The error message referred to the toString() call. After a full 10 minutes of pensive screen-staring, I decided to use trusted Google to look for an answer. Once again the answer came from a mailing list archive:

Unfortunately, this is one of those “known issues”. Apparently, you can’t use the toString() function on an XML document on a server with sandbox security.

The workaround is to use cfsavecontent to save the XML directly to a string.

One comments

  1. #1: Midnight Prophet Says:

    The only weapon we have to oppose the bad effects of technology is technology itself. There is no other. We can’t retreat into a nontechnological Eden which never existed…It is only by the rational use of technology, to control and guide what technology is doing, that we can keep any hopes of a social life more desireable than our own: or in fact of a social life which is not appalling to imagine.