Index: tests/phpunit/tests/query/metaQuery.php
===================================================================
--- tests/phpunit/tests/query/metaQuery.php	(revision 33848)
+++ tests/phpunit/tests/query/metaQuery.php	(working copy)
@@ -1694,4 +1694,57 @@
 
 		$this->assertEqualSets( array( 'foo_key', 'foo_key-1', 'foo_key-2' ), array_keys( $q->meta_query->get_clauses() ) );
 	}
+
+ 	/**
+	 * @ticket 27272
+	 */
+	public function test_cast_value_numeric_big() {
+		$posts = $this->factory->post->create_many( 1 );
+
+		// Will trigger (depending on system) MySQL string to float type conversion on quoted numbers.
+		$big_int = 0x20000000000001; // 0x20 0000 0000 0001 (54 bit integer + 1, 9007199254740993).
+		update_post_meta( $posts[0], 'foo', $big_int - 1 );
+
+		$q = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_term_meta_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => $big_int,
+					'compare' => '<',
+					'type' => 'NUMERIC',
+				),
+			),
+		) );
+		
+		$this->assertEquals( array( $posts[0] ), $q->posts );
+	}
+
+	/**
+	 * @ticket 27272
+	 */
+	public function test_cast_value_numeric_max() {
+		$posts = $this->factory->post->create_many( 1 );
+
+		$max_int = PHP_INT_MAX;
+		update_post_meta( $posts[0], 'foo', $max_int - 1 );
+
+		$q = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_term_meta_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => $max_int,
+					'compare' => '<',
+					'type' => 'NUMERIC',
+				),
+			),
+		) );
+		
+		$this->assertEquals( array( $posts[0] ), $q->posts );
+	}
 }
