Title:
Bug 72926:onMissingMethod() is not invoked for calls made to missing methods inside a component
| View in TrackerStatus/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): Sean Corfield / Sean Corfield (Sean Corfield)
Created: 09/10/2008
Components: Language, CF Component
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 10
Problem:
onMissingMethod() is not invoked for calls made to missing methods inside a component.
Groovy's invokeMethod() - the equivalent to onMissingMethod() - *does* get invoked when calls are made inside an object to missing methods.
ColdFusion only invokes onMissingMethod() for calls made from outside an object. It should also invoke onMissingMethod() for calls made *inside* an object via variables.someMethod() or just someMethod().
A workaround is to use this.someMethod() but that's ugly!
Method:
<!--- untested code but it should work modulo any typos :) --->
<cfcomponent>
<cffunction name="onMissingMethod">
<cfargument name="missingMethodName">
<cfargument name="missingMethodArguments">
<cfoutput>You called #missingMethodName#</cfoutput>
</cffunction>
<cffunction name="test">
<cfset someBogusMethod()>
</cffunction>
</cfcomponent>
<cfset x = createObject("component","test")>
<cfset x.someBogusMethod()> <!--- works, prints message --->
<cfset x.test()> <!--- fails, call inside test() does not invoke onMissingMethod() --->
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3035960
External Customer Info:
External Company:
External Customer Name: Sean Corfield
External Customer Email: 479B4EDC43F3A88B992016B6
External Test Config: 09/10/2008
Attachments:
Comments: