Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 49862)
+++ src/wp-includes/post.php	(working copy)
@@ -7344,7 +7344,7 @@
 			$terms = get_object_term_cache( $post->ID, $taxonomy );
 			if ( false !== $terms ) {
 				foreach ( $terms as $term ) {
-					if ( ! isset( $term_ids[ $term->term_id ] ) ) {
+					if ( ! in_array( $term->term_id, $term_ids ) ) {
 						$term_ids[] = $term->term_id;
 					}
 				}
