tracker issue : CF-4175845

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

invoke() cannot invoke private method like <cfinvoke>

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 07/26/2016

Components: Language

Versions: 11.0

Failure Type: Usability Issue

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win All

Vote Count: 0

Problem Description:

invoke() should be able to invoke a local private method within the same cfc just like <cfinvoke>


Steps to Reproduce:

<cfcomponent>
	
	<cffunction name="privateFunc" access="private">
		<cfreturn "OK!">
	</cffunction>
	
	<cffunction name="init">
		<cfinvoke method="privateFunc"/>
		
		<cfset invoke(this, "privateFunc")>
		
	</cffunction>

</cfcomponent>


Actual Result:

The method privateFunc was not found in component test.cfc.

Ensure that the method is defined, and that it is spelled correctly.
 
The error occurred in test.cfc: line 10
8 : 		<cfinvoke method="privateFunc"/>
9 : 		
10 : 		<cfset invoke(this, "privateFunc")>

Expected Result:

private function should be allowed to be invoked

Any Workarounds:

none.

I think invoke("privateFunc") should work for invoking local methods, private or not private.

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

Watson Bug ID:	4175845

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

Attachments:

Comments:

Nevermind, double checked the doc and I can use invoke("", "privateFunc")
Comment by External U.
2113 | July 26, 2016 05:46:11 PM GMT
As mentioned, private local methods can be invoked with an empty string as the first parameter. Closing the bug as Withdrawn > Not A Bug Thanks Henry.
Comment by Immanuel N.
2114 | July 27, 2016 11:07:11 PM GMT