[wp-trac] [WordPress Trac] #61970: Fatal error: Attempt to read property "ID" on null in /src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

WordPress Trac noreply at wordpress.org
Mon Oct 14 20:53:36 UTC 2024


#61970: Fatal error: Attempt to read property "ID" on null in /src/wp-includes
/rest-api/endpoints/class-wp-rest-autosaves-controller.php
-------------------------------------------------+-------------------------
 Reporter:  antonvlasenko                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:  template,
  testing-info                                   |  rest-api
-------------------------------------------------+-------------------------
Changes (by antonvlasenko):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests has-
     testing-info


Comment:

 Steps to test https://github.com/WordPress/wordpress-develop/pull/7272:

 1. On a ''fresh'' installation of WordPress, activate the `Twenty Twenty-
 Four` theme.
 2. Send a GET request to the following endpoint: `/wp-
 json/wp/v2/templates/twentytwentyfour//search/revisions/1`
 3. Observe that there are no REST API-related fatal PHP errors in the logs
 and that you receive the following REST response:
 {{{

    {
      "code": "rest_invalid_template",
      "message": "Templates based on theme files can't have revisions.",
      "data": {
        "status": 400
      }
    }
 }}}

 P.S. While manual testing is important, the aforementioned PR contains
 unit tests that verify the endpoint returns the correct response.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61970#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list