tracker issue : CF-4104246

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

[ANeff] Bug for: isObject(image) and isObject(spreadsheet) and isObject(file) return YES

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 01/06/2016

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Listed in the version 2016.0.03.300466 Issues Fixed doc
isObject(image) and isObject(spreadsheet) returns YES

Repro:

<cfscript>
  cfhtmltopdf(name="myPDF") {writeOutput("foo");};
  myQuery = queryNew("myColumn");
  myXML = xmlNew();
  myArray = [];
  myStruct = {};
  myImage = imageNew("", 1, 1);
  mySpreadsheet = spreadsheetNew("mySheet");
  writeOutput(isObject(myPDF) & isObject(myQuery) & isObject(myXML) & isObject(myArray) & isObject(myStruct) & isObject(myImage) & isObject(mySpreadsheet));
</cfscript>

Actual result: NONONONONOYESYES

Expected result: NONONONONONONO or YESYESYESYESYESYESYES

It should be consistent.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4104246

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:

Attachments:

Comments:

Can the title please be changed to: [ANeff] Bug for: isObject(image) and isObject(spreadsheet) and isObject(file) return YES Updated repro which shows isObject() returns YES for a file object: <cfscript> cfhtmltopdf(name="myPDF") {writeOutput("foo");}; myQuery = queryNew("myColumn"); myXML = xmlNew(); myArray = []; myStruct = {}; myImage = imageNew("", 1, 1); mySpreadsheet = spreadsheetNew("mySheet"); fileWrite(expandPath("./myFile.txt"), "foo"); myFile = fileOpen(expandPath("./myFile.txt")); writeOutput(isObject(myPDF) & isObject(myQuery) & isObject(myXML) & isObject(myArray) & isObject(myStruct) & isObject(myImage) & isObject(mySpreadsheet) & isObject(myFile)); </cfscript> Thanks!, -Aaron
Comment by External U.
4940 | January 06, 2016 03:00:18 AM GMT
For my last comment: Actual result: NONONONONOYESYESYES Expected result: NONONONONONONONO or YESYESYESYESYESYESYESYES Thanks!, -Aaron
Comment by External U.
4941 | January 06, 2016 03:02:47 AM GMT
Updated the title, Aaron
Comment by Immanuel N.
4942 | January 06, 2016 04:43:08 AM GMT
Hi Immanuel, Thank you very much! -Aaron
Comment by External U.
4943 | January 06, 2016 04:47:56 AM GMT
On a similar note: While testing this and using CF 10,0,17,295085 Developer (Windows), I noticed that isPDFObject() returns different results depending on whether the PDF was read from a file or generated in memory. PDFs generated in memory return "no/false". (My tests reveal that the in-memory PDF is a "binary/byte[]" type.) <cfdocument name="varPDF" format="pdf"> <cfoutput>This is a PDF</cfoutput> </cfdocument> <cfpdf name="filePDF" source="c:\test.pdf" action="read"> <cfoutput> isPDFObject(varPDF) = #isPDFObject(varPDF)# (Should be Yes)<br> isPDFObject(filePDF) = #isPDFObject(filePDF)# (Should be Yes) </cfoutput>
Comment by External U.
4944 | January 06, 2016 09:43:27 AM GMT
James, I raised another bug, CF-4179264, to track reported inconsistencies in isPDFObject() For the rest of the cases, isObject returns NO. isObject returns True/YES only for ColdFusion objects.
Comment by Immanuel N.
4945 | August 08, 2016 12:45:49 AM GMT
This probably needs reopening as the implementation is still not quite correct: <cfoutput>#isObject(javacast("null", 0))#</cfoutput> Outputs: Yes It seems to me that the implementation is just wrong, because this check should simply be checking if the argument is an instance of whatever underlying class represents a CFC instance; which NULL - and all those other types - are not. It seems like it's going "is it one of these? No, good. What about one of these? No. OK... one of these? No. These? [... etc]" through a long list of types and once it gets to the end is going "OK, maybe it's a CFC instance.
Comment by Adam C.
4946 | May 20, 2017 08:15:33 AM GMT