Copy link to clipboard
Copied
I'm playing around with GetMetaData to do a little introspection of my CFC's when I ran into an anomaly I don't understand.
My CFC has multiple functions embedded within it. One of these functions is defined as follows:
<cffunction name="getMyDenied" access="public" returntype="query">
<cfargument name="userid" type="string" required="yes">
<cfargument name="environment" type="string" required="no" default="0" hint="Pass in 0 for Development and 1 for Production">
...
</CFFUNCTION>
When I exam the CFC using GetMetaData I get this output for the getMyDenied function:
The thing that confuses me is why the HINT parameter is showing up in the userid argument.
The weird thing about this is if I exam the HINT parameter using #Len(TRIM(CFC_Functions.functions[cc].Parameters[1].Hint))# I get the number 6. If I copy the value into a new array or structure and then CFDUMP the results it shows up as an "Empty String".
Then in the same CFC I also have this function:
<cffunction name="getMyPurchaseOrders" access="public" returntype="query">
<cfargument name="userid" type="numeric" required="yes">
<cfargument name="environment" type="string" required="no" default="0" hint="Pass in 0 for Development and 1 for Production">
...
</CFFUNCTION>
When I exam the CFC using GetMetaData I get this output for the getMyPurchaseOrders function:
So my two questions are:
Any thoughts or suggestions are welcome!!!
@BKBK, I'm using CF Server 9,0,0,251028. I expected to see something similar to what you displayed too, which is why I was confused.
Still not sure why the GetMetaData call is returning the phantom parameter but I finally figured out what the returned value was! Of course once the light came on I felt a little like a dumba$$. 😮
Question: What takes 6 characters to display a blank space? Answer: "& nbsp ;" (without the spaces so it will display in this form) of course. Once I built my trap to
Copy link to clipboard
Copied
Weird. What is your ColdFusion version? How do you display the metadata?
I am on Coldfusion 2016. I wrote a CFC based on your 2 functions, and called it test.cfc. Then I ran this code in a page on the same directory:
<cfset obj=createobject("component","test")>
<cfdump var="#getMetadata(obj).functions#">
The result is as expected.
Copy link to clipboard
Copied
@BKBK, I'm using CF Server 9,0,0,251028. I expected to see something similar to what you displayed too, which is why I was confused.
Still not sure why the GetMetaData call is returning the phantom parameter but I finally figured out what the returned value was! Of course once the light came on I felt a little like a dumba$$. 😮
Question: What takes 6 characters to display a blank space? Answer: "& nbsp ;" (without the spaces so it will display in this form) of course. Once I built my trap to look for those 6 characters I was able to programmatically deal with the phantom parameter.