tracker issue : CF-4205189

select a category, or use search below
(searches all categories and all time range)
Title:

ToString() member function returns a location rather than string

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Nick P. / ()

Created: 09/06/2019

Components: Functions, String

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: CF 10, 11, 2016, and 2018 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 0

Problem Description:
When you run the ToString() headless function on query column, you get back the string-typed version of that column's value. However, when you use the .toString() member function, you incorrectly get back what looks like a memory location (for example: "coldfusion.sql.QueryColumn@58c93247")

Tested and found this same behavior in CF 10, 11, 2016, and 2018

Steps to Reproduce:
<cfscript>
  sampleQuery = QueryNew( "ID", "Integer" , {"id": 123} );
  WriteOutput( sampleQuery.ID.toString() );
</cfscript>

Actual Result:
coldfusion.sql.QueryColumn@58c93247
(the hex at the end changes with each request)

Expected Result:
123
(as a string)

Any Workarounds:
Use the headless ToString() function:
<cfscript>
  sampleQuery = QueryNew( "ID", "Integer" , {"id": 123} );
  WriteOutput( toString(sampleQuery.ID) );
</cfscript>

Attachments:

Comments: