Search code examples
coldfusioncoldfusion-9cfmlcoldfusion-11wddx

CFML2WDDX Error ColdFusion 11


I am using CFM2WDDX to convert an array in CF11 but I am getting this error:

coldfusion.tagext.validation.WddxValidator$InvalidWddxPacketException: Invalid WDDX packet..

I am using this code here:

getFileList.cfm

<cfsetting enablecfoutputonly="Yes">
<cfset thisdir = ExpandPath(".\")>
<cfdirectory directory="#thisdir#" action="LIST" name="imagefiles" recurse="No">
<cfscript>
// get .gif|.jpg|.png files from the cfdirectory query...
numRows = imagefiles.recordcount;
imageFileArray = ArrayNew(1);
for (row = 1; row LTE numRows; row++) {
    if (refindnocase("(.gif|.jpg|.png)",imagefiles.name[row]) neq 0) {
        ArrayAppend(imageFileArray, imagefiles.name[row]);
    }    
}
</cfscript>
<cfwddx action="cfml2wddx" input=#imageFileArray# output="wddxText">
<cfoutput>#wddxText#</cfoutput>

As you can see the code creates an array of image names that I am then accessing via cfhttp to do what ever I need with it. I have the same exact code with the same exact directory contents on a CF9 server and is working as it should but in CF11 I am getting formatting errors. Did this feature change in CF11 somehow?

This is the code I am using to access the code above:

<cfhttp url="http://example.com/images/ClientLogos/getFileList.cfm" method="GET" timeout="10" throwonerror="Yes">
    <cfwddx action="WDDX2CFML" input="#trim(cfhttp.filecontent)#" output="imageArray" validate="true">
    <cfreturn imageArray>

The getFileList.cfm is in the same directory with the images so it executes on the local server where is being called from. (that's why I thought CF11 might be the issue)

Part of the output from CF9:

enter image description here

And Part of the output from CF11:

enter image description here

CFHTTP.Header from CF 11:

HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Access-Control-Allow-Origin: * Date: Tue, 31 Mar 2015 18:50:35 GMT Connection: close Content-Length: 10807 

CFHTTP.Header from CF 9:

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Vary: Accept-Encoding Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Tue, 31 Mar 2015 18:51:20 GMT Connection: close


Solution

  • I am not sure what is causing this behavior but I found a middle ground for now. Instead of calling the getFileList.cfm via cfhttp I moved the code from getFileList.cfm directly inside my function and everything works. The reason for having that file to begin with it was allowing me to access an external image repo on a different server which I don't need/use anymore. Either way, this might actually be a CF11 bug so we shall see in the future...