[wp-trac] [WordPress Trac] #45677: REST Autosaves Controller creating extra instance of a post type REST controller
WordPress Trac
noreply at wordpress.org
Tue Oct 1 05:12:49 UTC 2019
#45677: REST Autosaves Controller creating extra instance of a post type REST
controller
--------------------------------------+--------------------------------
Reporter: pat@… | Owner: TimothyBlynJacobs
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.3
Component: REST API | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+--------------------------------
Comment (by TimothyBlynJacobs):
Thanks for the catch @dlh!
> The private static $post_type_controllers property was added but doesn't
appear to be used.
This was used in a previous version of the patch and I missed cleaning it
up. It can be safely removed.
> Can it not be because that would allow someone to register a post type
with an arbitrary rest_controller property?
Yeah that was my thinking. Though we still probably aren't strict enough
as you could pass a `rest_controller` argument as long as the
`rest_controller_class` was valid. We should probably enforce that
`rest_controller` is an `instanceof` `rest_controller_class` and that the
`rest_controller_class` is valid. We also don't want to return a
controller instance if the post type is not show_in_rest.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45677#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list