Opened 7 months ago
Closed 7 months ago
#63652 closed defect (bug) (fixed)
_oembed_rest_pre_serve_request() can erroneously return a string value
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | Embeds | Keywords: | good-first-bug has-patch |
| Focuses: | Cc: |
Description
_oembed_rest_pre_serve_request() is attached to the rest_pre_serve_request filter and is supposed to return a boolean value.
However, there is a code path where it returns a string via get_status_header_desc(), see the second conditional:
// Embed links inside the request.
$data = $server->response_to_data( $result, false );
if ( ! class_exists( 'SimpleXMLElement' ) ) {
status_header( 501 );
die( get_status_header_desc( 501 ) );
}
$result = _oembed_create_xml( $data );
// Bail if there's no XML.
if ( ! $result ) {
status_header( 501 );
return get_status_header_desc( 501 );
}
Since the function is expected to output a string, I think return should be replaced with die here, to match the first conditional.
Change History (5)
This ticket was mentioned in PR #9178 on WordPress/wordpress-develop by @abcd95.
7 months ago
#1
- Keywords has-patch added; needs-patch removed
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
7 months ago
Note: See
TracTickets for help on using
tickets.
@SergeyBiryukov I cannot figure out how to test it, and due to this, I am now adding needs-testing. If you think it should be tested, please provide testing instructions. If you think it doesn't need it, please proceed. Thank you!