Opened 8 years ago
Closed 8 years ago
#45189 closed defect (bug) (fixed)
Improve preloading request code
| Reported by: | schlessera | Owned by: | danielbachhuber |
|---|---|---|---|
| Priority: | low | Milestone: | 5.0 |
| Component: | REST API | Version: | 5.0 |
| Severity: | minor | Keywords: | has-patch fixed-5.0 |
| Cc: | Focuses: | rest-api |
Description
The attached patch removes the conditional branching based on the existence of the get_compact_response_links() method on the $server object, as that method was introduced with WordPress 4.5, and Gutenberg requires WordPress 4.9.8 or later.
Also, it turns the indirect and slow call through call_user_func() into a direct method call.
Note: The call would actually be more correct as a static call ($server::get_compact_response_links( $response)), but this notation is PHP 5.3+ only.
The patch is done against 5.0 branch.
Mirrors Gutenberg PR #11007 per request by @danielbachhuber.
Attachments (2)
Change History (7)
#2
in reply to: ↑ 1
@
8 years ago
- Focuses rest-api added
Replying to TimothyBlynJacobs:
If dropping the method exists check, I think it makes sense to drop it from
WP_REST_Controller::prepare_response_for_collection()as well.
Yes, let's do.
I wonder if this was included for BC because the server class is filterable, so theoretically someone could be using a server class without that method, though I think doing a completely custom class that doesn't extend
WP_REST_Serveris probably something that shouldn't/isn't supported anyways.
There are a ton of WP_REST_Server methods in use so, if someone is filtering the server, they need to implement all methods that could be used. I'm not concerned about BC here.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
If dropping the method exists check, I think it makes sense to drop it from
WP_REST_Controller::prepare_response_for_collection()as well.I wonder if this was included for BC because the server class is filterable, so theoretically someone could be using a server class without that method, though I think doing a completely custom class that doesn't extend
WP_REST_Serveris probably something that shouldn't/isn't supported anyways.