I have a bit of a stumper and I'm wondering if anyone can shed some
light on it. I have an object (User.cfc) that extends an object that
contains OnMissingMethod for dynamic get/set operations. It's working as
expected except for one thing, whenever I call user.getSomeValue(), the
string returned has white space prepended to it.

I've checked to see if it was getting the white space from the database
or from the setter, but that doesn't seem to be it. I've trimmed the
heck out of all the values and even thrown a trim() at the returned
value and the space is still there. Even odder, if I set a value equal
to the returned value, the space disappears.

Example:

<cfset userData = user.getInstance()> <!--- Returns instance structure
variables[instance][property]
<cfoutput>
1) -#userData.firstName#-<br> <!--- Displays -Anthony- --->     
2) -#user.getFirstName()#- <!--- Displays - Anthony- --->
3) -#trim(user.getFirstName())#-<br> <!-- Displays - Anthony- even with
trim() --->
<cfset fn = user.getFirstName()>
4) -#fn#- <!--- Displays -Anthony- --->
</cfoutput>

So 1 and 4 display as expected but 2 and 3 have the space (tab? Line
feed? Space? - I've tried to do an ASC() on it, but get the value 'A'
for the first character)

My OnMissingMethod is pretty straight forward (I've removed the error
handling for brevity):
--- SNIP ---
 switch(left(arguments.missingMethodName, 3)){
        case "get":
                propertyName =
replaceNoCase(arguments.missingMethodName, "get","");
                        if (structKeyExists(theVars,propertyName)){

                        return  trim(theVars[propertyName]);
                } 
        break;
        case "set":
                propertyName =
replaceNoCase(arguments.missingMethodName, "set","");
                if
(structKeyExists(variables["instance"]["properties"],propertyName)){
                        theVar =
trim(arguments.missingMethodArguments[1]);
                        variables["instance"][propertyName] =
trim(theVar);   
                    } else {
                        getErrorHandler().throw(message="Property
'#propertyName#' expects the '#variables.instance.properties[
propertyName ]#' data type.");
                    }
                break;
--- SNIP ---

If anyone can shed some light on this, it would be most appreciated.
I've been trying everything to no avail but perhaps I'm missing
something obvious that additional eyeball will see.

Thanks!

Anthony

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to