WordPress.org

Make WordPress Core

Ticket #18822: 18822.2.diff

File 18822.2.diff, 1.0 KB (added by scribu, 7 years ago)
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 76fdd65..9944b53 100644
    function &get_post(&$post, $output = OBJECT, $filter = 'raw') { 
    381381                _get_post_ancestors($post);
    382382                $_post = sanitize_post($post, 'raw');
    383383                wp_cache_add($post->ID, $_post, 'posts');
     384        } elseif ( is_object($post) && 'raw' == $post->filter ) {
     385                $_post = $post;
    384386        } else {
    385387                if ( is_object($post) )
    386388                        $post_id = $post->ID;
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index f47a860a..c0a9164 100644
    class WP_Query { 
    27452745
    27462746                $this->post_count = count($this->posts);
    27472747
    2748                 // Sanitize before caching so it'll only get done once
    2749                 for ( $i = 0; $i < $this->post_count; $i++ ) {
    2750                         $this->posts[$i] = sanitize_post($this->posts[$i], 'raw');
     2748                // Always sanitize
     2749                foreach ( $this->posts as $i => $post ) {
     2750                        $this->posts[$i] = sanitize_post( $post, 'raw' );
    27512751                }
    27522752
    27532753                if ( $q['cache_results'] )