Skip to content

Commit

Permalink
Fix a PHP Notice in REST API responses (#6576)
Browse files Browse the repository at this point in the history
* Remove is_array() check from gutenberg_add_block_format_to_post_content()

* Add back backward compatible check
  • Loading branch information
pento authored and gziolo committed May 4, 2018
1 parent 3128cea commit dd7dabd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function gutenberg_add_block_format_to_post_content( $response, $post, $request
}

$response_data = $response->get_data();
if ( is_array( $response_data['content'] ) && isset( $response_data['content']['raw'] ) ) {
if ( isset( $response_data['content'] ) && is_array( $response_data['content'] ) && isset( $response_data['content']['raw'] ) ) {
$response_data['content']['block_format'] = gutenberg_content_block_version( $response_data['content']['raw'] );
$response->set_data( $response_data );
}
Expand Down

0 comments on commit dd7dabd

Please sign in to comment.