WordPress.org

Make WordPress Core

Ticket #42238: #42238.patch

File #42238.patch, 1.1 KB (added by imani3011, 9 months ago)

New patch for #42238

  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    From 804bb2031643b19a1787442f220a5e2419e2a0d2 Mon Sep 17 00:00:00 2001
    From: Himani <himaniwork3010@gmail.com>
    Date: Sun, 24 Nov 2019 19:35:39 +0530
    Subject: [PATCH] Fix: #42238 Notice when Rest Comments controller is checking
     permission for a non existent post type
    
    ---
     .../rest-api/endpoints/class-wp-rest-comments-controller.php  | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    index f673450d41..c9dda586fa 100644
    a b class WP_REST_Comments_Controller extends WP_REST_Controller { 
    15841584        protected function check_read_post_permission( $post, $request ) {
    15851585                $posts_controller = new WP_REST_Posts_Controller( $post->post_type );
    15861586                $post_type        = get_post_type_object( $post->post_type );
     1587                // Return false if custom post type doesn't exist
     1588                if(is_null($post_type)) {
     1589                        return false;
     1590                }
    15871591
    15881592                $has_password_filter = false;
    15891593