Object of class stdClass could not be converted to string",… code example
Example: object of class stdclass could not be converted to string
Most likely, the userdata() function is returning an object, not a string. Look into the documentation (or var_dump the return value) to find out which value you need to use.