[wp-trac] [WordPress Trac] #45677: REST Autosaves Controller creating extra instance of a post type REST controller
WordPress Trac
noreply at wordpress.org
Wed Oct 2 01:19:32 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 dlh):
I can work on a patch to add those checks, but could you clarify what you
mean by validating the `rest_controller_class`?
Separately, by pure chance, a colleague found some code in the wild today
that generates a fatal error after [46272]. Simplified, it is:
{{{
$pt_object = get_post_type_object( 'post' );
$pt_object->rewrite = array( ... );
register_post_type( 'post', (array) $pt_object );
}}}
It breaks with the introduction of the private controller property, which
becomes `\0WP_Post_Type\0rest_controller` after being cast to `(array)`
and can't be set using `$this->$property_name` in `set_props()`.
The approach in that snippet is not ideal and so perhaps not in need of
special handling now, but I mention it "for the record" with respect to
backcompat.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45677#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list