Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 31319)
+++ src/wp-includes/query.php	(working copy)
@@ -3420,10 +3420,11 @@
 
 		if ( 'ids' == $q['fields'] ) {
 			$this->posts = $wpdb->get_col( $this->request );
+			$this->posts = array_map( 'intval', $this->posts );
 			$this->post_count = count( $this->posts );
 			$this->set_found_posts( $q, $limits );
 
-			return array_map( 'intval', $this->posts );
+			return $this->posts;
 		}
 
 		if ( 'id=>parent' == $q['fields'] ) {
@@ -3432,9 +3433,13 @@
 			$this->set_found_posts( $q, $limits );
 
 			$r = array();
-			foreach ( $this->posts as $post ) {
+			foreach ( $this->posts as $key => $post ) {
+				$this->posts[ $key ]->ID = (int) $post->ID;
+				$this->posts[ $key ]->post_parent = (int) $post->post_parent;
+
 				$r[ (int) $post->ID ] = (int) $post->post_parent;
 			}
+
 			return $r;
 		}
 
Index: tests/phpunit/tests/query/results.php
===================================================================
--- tests/phpunit/tests/query/results.php	(revision 31319)
+++ tests/phpunit/tests/query/results.php	(working copy)
@@ -387,6 +387,7 @@
 
 	/**
 	 * @ticket 27252
+	 * @ticket 31194
 	 */
 	function test_query_fields_integers() {
 
@@ -401,6 +402,7 @@
 		) );
 
 		$this->assertSame( $parents, $posts1 );
+		$this->assertSame( $parents, $this->q->posts );
 
 		$children = array(
 			(int) self::$child_one => (int) self::$parent_one,
@@ -415,6 +417,11 @@
 
 		$this->assertSame( $children, $posts2 );
 
+		foreach ( $this->q->posts as $post ) {
+			$this->assertInternalType( 'int', $post->ID );
+			$this->assertInternalType( 'int', $post->post_parent );
+		}
+
 	}
 
 	/**
