Make WordPress Core

Changeset 22264


Ignore:
Timestamp:
10/19/2012 09:53:17 PM (14 years ago)
Author:
ryan
Message:

Don't wp_cache_add() stdClass objects in get_post() to avoid polluting the cache with incomplete or otherwise compromised objects.

Declare the core properties of WP_Pist as proper public properties and provide them with defaults.

Props wonderboymusic
fixes #22223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r22232 r22264  
    390390                if ( empty( $post->filter ) ) {
    391391                        $_post = sanitize_post( $post, 'raw' );
    392                         wp_cache_add( $post->ID, $_post, 'posts' );
    393392                        $_post = new WP_Post( $_post );
    394393                } elseif ( 'raw' == $post->filter ) {
     
    419418 * @since 3.5.0
    420419 *
    421  * @property $ID;
    422  * @property $post_author;
    423  * @property $post_date;
    424  * @property $post_date_gmt;
    425  * @property $post_content;
    426  * @property $post_title;
    427  * @property $post_excerpt;
    428  * @property $post_status;
    429  * @property $comment_status;
    430  * @property $ping_status;
    431  * @property $post_password;
    432  * @property $post_name;
    433  * @property $to_ping;
    434  * @property $pinged;
    435  * @property $post_modified;
    436  * @property $post_modified_gmt;
    437  * @property $post_content_filtered;
    438  * @property $post_parent;
    439  * @property $guid;
    440  * @property $menu_order;
    441  * @property $post_type;
    442  * @property $post_mime_type;
    443  * @property $comment_count;
    444  * @property $ancestors;
    445420 */
    446421final class WP_Post {
    447422
     423        /**
     424         *
     425         * @var int
     426         */
     427        public $ID;
     428
     429        /**
     430         *
     431         * @var int
     432         */     
     433        public $post_author = 0;
     434
     435        /**
     436         *
     437         * @var string
     438         */     
     439        public $post_date = '0000-00-00 00:00:00';
     440
     441        /**
     442         *
     443         * @var string
     444         */             
     445        public $post_date_gmt = '0000-00-00 00:00:00';
     446
     447        /**
     448         *
     449         * @var string
     450         */             
     451        public $post_content = '';
     452
     453        /**
     454         *
     455         * @var string
     456         */             
     457        public $post_title = '';
     458
     459        /**
     460         *
     461         * @var string
     462         */             
     463        public $post_excerpt = '';
     464
     465        /**
     466         *
     467         * @var string
     468         */             
     469        public $post_status = 'publish';
     470
     471        /**
     472         *
     473         * @var string
     474         */             
     475        public $comment_status = 'open';
     476
     477        /**
     478         *
     479         * @var string
     480         */             
     481        public $ping_status = 'open';
     482
     483        /**
     484         *
     485         * @var string
     486         */             
     487        public $post_password = '';
     488
     489        /**
     490         *
     491         * @var string
     492         */             
     493        public $post_name = '';
     494
     495        /**
     496         *
     497         * @var string
     498         */             
     499        public $to_ping = '';
     500
     501        /**
     502         *
     503         * @var string
     504         */             
     505        public $pinged = '';
     506
     507        /**
     508         *
     509         * @var string
     510         */             
     511        public $post_modified = '0000-00-00 00:00:00';
     512
     513        /**
     514         *
     515         * @var string
     516         */             
     517        public $post_modified_gmt = '0000-00-00 00:00:00';
     518
     519        /**
     520         *
     521         * @var string
     522         */             
     523        public $post_content_filtered = '';
     524
     525        /**
     526         *
     527         * @var int
     528         */             
     529        public $post_parent = 0;
     530
     531        /**
     532         *
     533         * @var string
     534         */             
     535        public $guid = '';
     536
     537        /**
     538         *
     539         * @var int
     540         */     
     541        public $menu_order = 0;
     542
     543        /**
     544         *
     545         * @var string
     546         */     
     547        public $post_type = 'post';
     548
     549        /**
     550         *
     551         * @var string
     552         */             
     553        public $post_mime_type = '';
     554
     555        /**
     556         *
     557         * @var int
     558         */     
     559        public $comment_count = 0;
     560
     561        /**
     562         *
     563         * @var string
     564         */                     
    448565        public $filter;
    449566
Note: See TracChangeset for help on using the changeset viewer.