diff --git src/wp-includes/query.php src/wp-includes/query.php
index 27d8c26..c705622 100644
--- src/wp-includes/query.php
+++ src/wp-includes/query.php
@@ -4370,7 +4370,7 @@ class WP_Query {
 
 		$page = (array) $page;
 
-		if ( in_array( $page_obj->ID, $page ) ) {
+		if ( in_array( (string) $page_obj->ID, $page ) ) {
 			return true;
 		} elseif ( in_array( $page_obj->post_title, $page ) ) {
 			return true;
diff --git tests/phpunit/tests/query/conditionals.php tests/phpunit/tests/query/conditionals.php
index 70d5a7d..e6ebab9 100644
--- tests/phpunit/tests/query/conditionals.php
+++ tests/phpunit/tests/query/conditionals.php
@@ -809,4 +809,48 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
 		$this->assertTrue( is_attachment( $post->post_title ) );
 		$this->assertTrue( is_attachment( $post->post_name ) );
 	}
+
+	/**
+	 * @ticket 24674
+	 */
+	public function test_is_page_with_page_id_zero_and_random_page_slug() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$this->go_to( "/?page_id=$post_id" );
+
+		// override post ID to 0 temporarily for testing
+		$_id = $GLOBALS['wp_query']->post->ID;
+		$GLOBALS['wp_query']->post->ID = 0;
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( $q->is_page() );
+		$this->assertFalse( $q->is_page( 'sample-page' ) );
+		$this->assertFalse( $q->is_page( 'random-page-slug' ) );
+
+		// revert $wp_query global change
+		$GLOBALS['wp_query']->post->ID = $_id;
+	}
+
+	/**
+	 * @ticket 24674
+	 */
+	public function test_is_page_with_page_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() {
+		$p1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+
+		$p2_name = $p1 . '-page';
+		$p2 = $this->factory->post->create( array(
+			'post_type' => 'page',
+			'post_name' => $p2_name,
+		) );
+
+		$this->go_to( "/?page_id=$p1" );
+
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( $q->is_page() );
+		$this->assertTrue( $q->is_page( $p1 ) );
+		$this->assertFalse( $q->is_page( $p2_name ) );
+		$this->assertFalse( $q->is_page( $p2 ) );
+	}
 }
