Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 37650)
+++ src/wp-includes/post.php	(working copy)
@@ -4326,30 +4326,25 @@
  * @return WP_Post|array|void WP_Post on success or null on failure
  */
 function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
-	global $wpdb;
 
-	if ( is_array( $post_type ) ) {
-		$post_type = esc_sql( $post_type );
-		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
-		$sql = $wpdb->prepare( "
-			SELECT ID
-			FROM $wpdb->posts
-			WHERE post_title = %s
-			AND post_type IN ($post_type_in_string)
-		", $page_title );
-	} else {
-		$sql = $wpdb->prepare( "
-			SELECT ID
-			FROM $wpdb->posts
-			WHERE post_title = %s
-			AND post_type = %s
-		", $page_title, $post_type );
-	}
+	// Make sure that we actually get all the post statuses
+	$post_status = get_post_stati();
 
-	$page = $wpdb->get_var( $sql );
+	$query = new WP_Query(
+		array(
+			'title'          => $page_title,
+			'post_type'      => $post_type,
+			'posts_per_page' => 1,
+			'post_status'    => $post_status,
+			'orderby'        => 'ID',
+			'order'          => 'ASC',
+			'fields'         => 'ids'
+		)
+	);
+	$posts = $query->get_posts();
 
-	if ( $page ) {
-		return get_post( $page, $output );
+	if ( $posts ) {
+		return get_post( $posts[0], $output );
 	}
 }
 
