Make get_object_terms work with and without object caching.

When `get_object_terms` resorts to using `get_the_terms`, `get_object_term_cache` is called.
The data stored by `update_object_term_cache` is 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.