diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 40ac51cf29..35bc2a9538 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -82,13 +82,13 @@ wp_enqueue_script( 'svg-painter' ); $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); ?> diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index 30a05bf607..682a9a606c 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -581,6 +581,8 @@ class Custom_Background { * @deprecated 3.5.0 */ public function wp_set_background_image() { + check_ajax_referer( 'custom-background' ); + if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) { exit; } diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 8f005b164b..716afc8679 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -343,7 +343,7 @@ class Custom_Image_Header { ?> addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} -var ajaxurl = '', - pagenow = 'id; ?>', - typenow = 'post_type; ?>', - adminpage = '', - thousandsSeparator = 'number_format['thousands_sep'] ); ?>', - decimalPoint = 'number_format['decimal_point'] ); ?>', +var ajaxurl = '', + pagenow = 'id ); ?>', + typenow = 'post_type ); ?>', + adminpage = '', + thousandsSeparator = 'number_format['thousands_sep'] ); ?>', + decimalPoint = 'number_format['decimal_point'] ); ?>', isRtl = ; - +
diff --git a/wp-admin/network/site-users.php b/wp-admin/network/site-users.php index cb00cab973..8be61a350f 100644 --- a/wp-admin/network/site-users.php +++ b/wp-admin/network/site-users.php @@ -217,7 +217,7 @@ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users require_once ABSPATH . 'wp-admin/admin-header.php'; ?> diff --git a/wp-includes/Requests/Utility/FilteredIterator.php b/wp-includes/Requests/Utility/FilteredIterator.php index 76a29e7228..c657433248 100644 --- a/wp-includes/Requests/Utility/FilteredIterator.php +++ b/wp-includes/Requests/Utility/FilteredIterator.php @@ -42,4 +42,17 @@ class Requests_Utility_FilteredIterator extends ArrayIterator { $value = call_user_func($this->callback, $value); return $value; } + + /** + * @inheritdoc + */ + public function unserialize( $serialized ) { + } + + /** + * @inheritdoc + */ + public function __unserialize( $serialized ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound + $this->unserialize( $serialized ); + } } diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 8fce283325..719887122c 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -3879,6 +3879,21 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 403, __( 'Comment is required.' ) ); } + if ( + 'publish' === get_post_status( $post_id ) && + ! current_user_can( 'edit_post', $post_id ) && + post_password_required( $post_id ) + ) { + return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); + } + + if ( + 'private' === get_post_status( $post_id ) && + ! current_user_can( 'read_post', $post_id ) + ) { + return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); + } + $comment = array( 'comment_post_ID' => $post_id, 'comment_content' => $content_struct['content'], @@ -4292,7 +4307,7 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.getMediaItem' ); $attachment = get_post( $attachment_id ); - if ( ! $attachment ) { + if ( ! $attachment || 'attachment' !== $attachment->post_type ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); } diff --git a/wp-includes/embed.php b/wp-includes/embed.php index ac652a34e1..33f49b517f 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -614,6 +614,11 @@ function get_oembed_response_data_for_url( $url, $args ) { $sites = get_sites( $qv ); $site = reset( $sites ); + // Do not allow embeds for deleted/archived/spam sites. + if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) { + return false; + } + if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { switch_to_blog( $site->blog_id ); $switched_blog = true; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 5f4cf53dee..b52ffb073f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1742,7 +1742,8 @@ function is_blog_installed() { continue; } - if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) { + $described_table = $wpdb->get_results( "DESCRIBE $table;" ); + if ( is_array( $described_table ) && count( $described_table ) === 0 ) { continue; } diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 99df89697f..32357c1e32 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -1045,7 +1045,8 @@ function _get_meta_table( $type ) { * @return bool Whether the meta key is considered protected. */ function is_protected_meta( $meta_key, $meta_type = '' ) { - $protected = ( '_' == $meta_key[0] ); + $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); + $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); /** * Filters whether a meta key is considered protected. diff --git a/wp-includes/version.php b/wp-includes/version.php index 5537bfe7fa..a4170fc592 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4.3-alpha-49364'; +$wp_version = '5.4.3-alpha-49391'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.