tracker issue : CF-4026104

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

Arrays-of-objects returntype checking is flaky

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 07/26/2015

Components: Language

Versions: 2016,11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final / 318001

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Repro:

{code}
// safeRun.cfm

function safeRun(message="", task){
	try {
		writeOutput("#message#<br>");
		task();
	}catch (any e){
		writeOutput("
			Type: #e.type#<br>
			Message: #e.message#<br>
		");
	} finally {
		writeOutput("<hr>");
	}
}	
{code}

{code}
//  Test.cfc
component {}
{code}

{code}
// NotTest.cfc
component {}
{code}

{code}
// arraysOfObjectsAsReturnType.cfm

include "safeRun.cfm";

Test[] function returnsArrayOfTests(size){
	var baseArray = [];
	baseArray.set(1, size, new Test());
	return baseArray;
}
safeRun("Array of Tests", function(){
	tests = returnsArrayOfTests(5);
	writeDump(tests);
});


NotTest[] function returnsArrayOfNotTests(size){
	var baseArray = [];
	baseArray.set(1, size, new Test());
	return baseArray;
}
safeRun("Array of NotTests", function(){
	tests = returnsArrayOfNotTests(5);
	writeDump(tests);
});


Test[] function returnsInvalidArrayOfTests(size){
	var baseArray = [];
	baseArray.set(1, size, new Test());
	baseArray.append(new NotTest());
	return baseArray;
}
safeRun("Invalid array of Tests", function(){
	tests = returnsInvalidArrayOfTests(1);
	writeDump(tests);
});
{code}

Expected:
for both second an third example to error as the return types are not correct.

Actual:
third one doesn't error, despite the array holding an illegal type.

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

Watson Bug ID:	4026104

Reason:	BugVerified

External Customer Info:
External Company:  
External Customer Name: Adam
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Can you please confirm in what version of ColdFusion this is going to be implemented in. It says "to fix" but does not say which version.
Comment by External U.
6463 | January 25, 2016 08:17:22 AM GMT