3

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

Geo
  • 3,160
  • 6
  • 41
  • 82
  • https://bugbase.adobe.com/ – Henry Mar 31 '15 at 17:41
  • @Henry are you saying I should add this to the bugbase or search it from similar issues? – Geo Mar 31 '15 at 18:04
  • If you just browse to your `getFileList.cfm` page does it display the data in WDDX format? I just did a quick test on a local CF9 and CF11 server. Both worked as expected. I did not perform the `cfhttp` part however. I just browsed to my test page. – Miguel-F Mar 31 '15 at 18:25
  • @Geo if you have a reproducible unexpected case, file as a bug report there. – Henry Mar 31 '15 at 18:27
  • 1
    *Part of the output from CF9:* Just to clarify, did you actually run a compare on the two `filecontent` values to verify the strings are *truly* the same (not just look the same) AND also compare the cfhttp headers? Does the full stack trace provide any other details about the packet problem or is it just boilerplate stuff? – Leigh Mar 31 '15 at 18:32
  • @Miguel-F if you browse to the getFileList.cfm it works fine. The part after that is what is causing the issue – Geo Mar 31 '15 at 18:35
  • @Leigh I will do that and let you know! – Geo Mar 31 '15 at 18:35
  • Yes I realize that. What I meant was is the displayed data valid WDDX? I think Leigh and I are after the same thing. What is different in the output between CF9 and CF11. It could just be that the validation is different in CF11 (since you have `validate` set to true). If your comparison of output between versions does not show any difference try setting `validate="false"` just to see what happens. – Miguel-F Mar 31 '15 at 18:40
  • I am getting different output on the header @Leigh I will update my question with the header string. – Geo Mar 31 '15 at 18:52
  • @Miguel-F Same thing when the validation is set to false bud :/ – Geo Mar 31 '15 at 18:53
  • Do I have to turn on a setting in CF Admin maybe? – Geo Mar 31 '15 at 18:56

1 Answers1

0

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

Geo
  • 3,160
  • 6
  • 41
  • 82
  • What is the difference in the generated WDDX string? – James A Mohler Mar 31 '15 at 20:57
  • @JamesAMohler none at all! – Geo Apr 01 '15 at 00:17
  • (Edit) @Geo - (Agreed the removal of cfhttp makes more sense, since it is no longer needed. But out of curiosity ...) you checked it character by character and *everything* is the same, including white space? – Leigh Apr 01 '15 at 19:35
  • @Leigh the only thing I could do is remove everything from that folder and leave only one image file. I will do that and let you know. (I'm pretty sure of the outcome but I will try anw :) ) – Geo Apr 02 '15 at 10:41
  • @Geo - You could compare the original strings. Start with a len() and compare() check of the whole string. If both are the same, then you know the problem is something else like the headers, etcetera. Otherwise, use a loop to check char by char for differences ie `cfloop from=1 to=len(theString)...` and `mid(theString,index,1)` to get each character. – Leigh Apr 02 '15 at 13:40