Replace the sanitize loop at the end of WP_Query::get_posts() with an array_map of get_post(). get_post() will ensure each object in the loop is sanitized and is of the type WP_Post. see #22162

git-svn-id: http://core.svn.wordpress.org/trunk@22238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-10-15 20:42:57 +00:00
parent e65187ada5
commit 7bf8c86dac
1 changed files with 4 additions and 4 deletions

View File

@ -2774,10 +2774,10 @@ class WP_Query {
$this->post_count = count( $this->posts ); $this->post_count = count( $this->posts );
// Always sanitize // Ensure that any posts added/modified via one of the filters above are
foreach ( $this->posts as $i => $post ) { // of the type WP_Post and are filtered.
$this->posts[$i] = sanitize_post( $post, 'raw' ); if ( $this->posts )
} $this->posts = array_map( 'get_post', $this->posts );
if ( $q['cache_results'] ) if ( $q['cache_results'] )
update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']); update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);