Make WordPress Core

Opened 5 days ago

Last modified 5 days ago

#61970 new defect (bug)

Fatal error: Attempt to read property "ID" on null in /src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

Reported by: antonvlasenko's profile antonvlasenko Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: REST API Keywords: has-patch has-unit-tests
Focuses: template, rest-api Cc:

Description

This error occurs when a user tries to fetch autosave posts or revisions for a template (template part) that is file-based and does not have an associated entity in the posts table.
The returned HTTP code is 403, which is also incorrect.
Both the fatal error and the HTTP code need to be fixed.

Change History (2)

#1 @antonvlasenko
5 days ago

Props to @Mamaduka for discovering this issue.

This ticket was mentioned in PR #7272 on WordPress/wordpress-develop by @antonvlasenko.


5 days ago
#2

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
Note: See TracTickets for help on using tickets.