Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 26246)
+++ src/wp-includes/query.php	(working copy)
@@ -3122,7 +3122,7 @@
 			do_action_ref_array('loop_start', array(&$this));
 
 		$post = $this->next_post();
-		setup_postdata($post);
+		$this->setup_postdata( $post );
 	}
 
 	/**
@@ -3323,6 +3323,57 @@
 	}
 
 	/**
+	 * Set up global post data.
+	 *
+	 * @param object $post Post data.
+	 * @uses do_action_ref_array() Calls 'the_post'
+	 * @return bool True when finished.
+	 */
+	function setup_postdata( $post ) {
+		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
+
+		$id = (int) $post->ID;
+
+		$authordata = get_userdata( $post->post_author );
+
+		$currentday = mysql2date( 'd.m.y', $post->post_date, false );
+		$currentmonth = mysql2date( 'm', $post->post_date, false );
+		$numpages = 1;
+		$page = $this->get( 'page' );
+		if ( ! $page ) {
+			$page = 1;
+		}
+
+		if ( $this->is_single() || $this->is_page() || $this->is_feed() ) {
+			$more = 1;
+		}
+		$content = $post->post_content;
+		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
+			if ( $page > 1 ) {
+				$more = 1;
+			}
+			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
+			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
+			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
+			// Ignore nextpage at the beginning of the content.
+			if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
+				$content = substr( $content, 15 );
+			}
+			$pages = explode( '<!--nextpage-->', $content );
+			$numpages = count( $pages );
+			$multipage = $numpages > 1 ? 1 : 0;
+		} else {
+			$pages = array( $post->post_content );
+			$multipage = 0;
+		}
+
+		do_action( 'the_post', $post );
+
+		return true;
+	}
+
+
+	/**
 	 * Constructor.
 	 *
 	 * Sets up the WordPress query, if parameter is not empty.
@@ -3924,40 +3975,10 @@
  * @return bool True when finished.
  */
 function setup_postdata( $post ) {
-	global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
+	global $wp_query;
 
-	$id = (int) $post->ID;
+	if ( is_a( $wp_query, 'WP_Query' ) )
+		return $wp_query->setup_postdata( $post );
 
-	$authordata = get_userdata($post->post_author);
-
-	$currentday = mysql2date('d.m.y', $post->post_date, false);
-	$currentmonth = mysql2date('m', $post->post_date, false);
-	$numpages = 1;
-	$multipage = 0;
-	$page = get_query_var('page');
-	if ( ! $page )
-		$page = 1;
-	if ( is_single() || is_page() || is_feed() )
-		$more = 1;
-	$content = $post->post_content;
-	if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
-		if ( $page > 1 )
-			$more = 1;
-		$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
-		$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
-		$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
-		// Ignore nextpage at the beginning of the content.
-		if ( 0 === strpos( $content, '<!--nextpage-->' ) )
-			$content = substr( $content, 15 );
-		$pages = explode('<!--nextpage-->', $content);
-		$numpages = count($pages);
-		if ( $numpages > 1 )
-			$multipage = 1;
-	} else {
-		$pages = array( $post->post_content );
-	}
-
-	do_action_ref_array('the_post', array(&$post));
-
-	return true;
+	return false;
 }
