Fix lingering reference problem in `wp_get_object_terms()` by not setting the `foreach`'d vars to a reference. Adds unit test.

Props stephenharris.
Fixes #26339.



git-svn-id: https://develop.svn.wordpress.org/trunk@26510 602fd350-edb4-49c9-b593-d223f7449a82