Make WordPress Core

Ticket #40286: 40286.3.diff

File 40286.3.diff, 1.2 KB (added by rachelbaker, 8 years ago)

Adds conditional to use 0 if $_post->ID is undefined

  • src/wp-includes/comment-template.php

     
    11911191
    11921192        $_post = get_post($post_id);
    11931193
     1194        $post_id = $_post ? $_post->ID : 0;
    11941195        $open = ( 'open' == $_post->comment_status );
    11951196
    11961197        /**
     
    11981199         *
    11991200         * @since 2.5.0
    12001201         *
    1201          * @param bool        $open    Whether the current post is open for comments.
    1202          * @param int|WP_Post $post_id The post ID or WP_Post object.
     1202         * @param bool $open    Whether the current post is open for comments.
     1203         * @param int  $post_id Post ID.
    12031204         */
    12041205        return apply_filters( 'comments_open', $open, $post_id );
    12051206}
     
    12161217
    12171218        $_post = get_post($post_id);
    12181219
     1220        $post_id = $_post ? $_post->ID : 0;
    12191221        $open = ( 'open' == $_post->ping_status );
    12201222
    12211223        /**
     
    12231225         *
    12241226         * @since 2.5.0
    12251227         *
    1226          * @param bool        $open    Whether the current post is open for pings.
    1227          * @param int|WP_Post $post_id The post ID or WP_Post object.
     1228         * @param bool $open    Whether the current post is open for pings.
     1229         * @param int  $post_id Post ID.
    12281230         */
    12291231        return apply_filters( 'pings_open', $open, $post_id );
    12301232}