Title:
Incorrect cast when iterating over an array of elements containing values from a query object.
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): JF Robichaud / JF Robichaud (jfrobishow)
Created: 09/04/2014
Components: Database, Query-of-Query(IMQ)
Versions: 11.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: CF11_Final / CF11 Update5
Priority/Frequency: Normal / Some users will encounter
Locale/System: ALL / Windows 7 64-bit
Vote Count: 2
Problem Description:
When populating the value of an array by iterating over a query object containing Int/BigInt ArrayFind doesn't produce the expected result when used within a for loop.
Direct access works. If you trim the iterator value you also get the expected result. Changing the query column type to something other than an array also work.
Steps to Reproduce:
<cfscript>
/*
Valid column type. Integer and BigInt do not produce the expected result.
Integer | BigInt | Double | Decimal | VarChar | Binary | Bit | Time | Date | Timestamp | Object
*/
rs = queryNew("column1", "Integer");
queryAddRow(rs, 2);
querySetCell(rs, "column1", 1, 1);
querySetCell(rs, "column1", 1, 1);
querySetCell(rs, "column1", 2, 2);
querySetCell(rs, "column1", 2, 2);
</cfscript>
<cfset x = arraynew(1)>
<cfloop query="rs">
<cfset x[arrayLen(x)+1] = rs["column1"][rs.CurrentRow]>
</cfloop>
<cfscript>
writeDump(x);
for(i=1; i <= rs.RecordCount; i++){
writeDump(arrayFind(x, i)); //Expected result - find the value... it doesn't on CF but works correctly on Railo.
writeOutput("<br>");
}
</cfscript>
Actual Result: Expecting ArrayFind to find the value. It doesn't.
Expected Result: Expecting ArrayFind to find the value. It doesn't.
Any Workarounds:
Changing the column type to something other than integer.
or Triming the iterator before passing it to arrayFind
or Trimming the value before storing it in the array.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3818587
External Customer Info:
External Company:
External Customer Name: jfrobishow
External Customer Email:
External Test Config: My Hardware and Environment details: Fails on CFLive.net and works on Railo.
Attachments:
Comments: