Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 27345)
+++ src/wp-includes/query.php	(working copy)
@@ -3190,7 +3190,7 @@
 			$this->post_count = count( $this->posts );
 			$this->set_found_posts( $q, $limits );
 
-			return $this->posts;
+			return array_map( 'intval', $this->posts );
 		}
 
 		if ( 'id=>parent' == $q['fields'] ) {
@@ -3200,7 +3200,7 @@
 
 			$r = array();
 			foreach ( $this->posts as $post )
-				$r[ $post->ID ] = $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 27345)
+++ tests/phpunit/tests/query/results.php	(working copy)
@@ -46,10 +46,10 @@
 		$this->parent_one = $this->factory->post->create( array( 'post_title' => 'parent-one', 'post_date' => '2007-01-01 00:00:00' ) );
 		$this->parent_two = $this->factory->post->create( array( 'post_title' => 'parent-two', 'post_date' => '2007-01-01 00:00:00' ) );
 		$this->parent_three = $this->factory->post->create( array( 'post_title' => 'parent-three', 'post_date' => '2007-01-01 00:00:00' ) );
-		$this->factory->post->create( array( 'post_title' => 'child-one', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:01' ) );
-		$this->factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:02' ) );
-		$this->factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:03' ) );
-		$this->factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:04' ) );
+		$this->child_one = $this->factory->post->create( array( 'post_title' => 'child-one', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:01' ) );
+		$this->child_two = $this->factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:02' ) );
+		$this->child_three = $this->factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:03' ) );
+		$this->child_four = $this->factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:04' ) );
 
 		unset( $this->q );
 		$this->q = new WP_Query();
@@ -370,6 +370,37 @@
 		), wp_list_pluck( $posts, 'post_title' ) );
 	}
 
+	/**
+	 * @ticket 27252
+	 */
+	function test_query_fields_integers() {
+
+		$parents = array(
+			(int) $this->parent_one,
+			(int) $this->parent_two
+		);
+		$posts = $this->q->query( array(
+			'post__in'  => $parents,
+			'fields'    => 'ids',
+			'orderby'   => 'post__in',
+			) );
+
+		$this->assertSame( $parents, $posts );
+
+		$children = array(
+			(int) $this->child_one => (int) $this->parent_one,
+			(int) $this->child_two => (int) $this->parent_one
+		);
+		$posts = $this->q->query( array(
+			'post__in'  => array_keys( $children ),
+			'fields'    => 'id=>parent',
+			'orderby'   => 'post__in',
+			) );
+
+		$this->assertSame( $children, $posts );
+
+	}
+
 	function test_exlude_from_search_empty() {
 		global $wp_post_types;
 		foreach ( array_keys( $wp_post_types ) as $slug )
