Make get_object_terms work with and without object caching.
When get_object_terms resorts to using get_the_terms, get_the_terms calls get_object_term_cache.
The data stored by update_object_term_cache stores it in an associative array, the key being the term id.
This causes $name[0]->slug to attempt to access an array item that doesn't exist.
This PR makes use of the `key` function to get the first item from the array regardless of whether it's associative or not.