diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 4d7bf3ba44..be369a1cb3 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -5098,10 +5098,10 @@ final class WP_Customize_Manager { 'label' => __( 'Logo' ), 'section' => 'title_tagline', 'priority' => 8, - 'height' => $custom_logo_args[0]['height'], - 'width' => $custom_logo_args[0]['width'], - 'flex_height' => $custom_logo_args[0]['flex-height'], - 'flex_width' => $custom_logo_args[0]['flex-width'], + 'height' => isset( $custom_logo_args[0]['height'] ) ? $custom_logo_args[0]['height'] : null, + 'width' => isset( $custom_logo_args[0]['width'] ) ? $custom_logo_args[0]['width'] : null, + 'flex_height' => isset( $custom_logo_args[0]['flex-height'] ) ? $custom_logo_args[0]['flex-height'] : null, + 'flex_width' => isset( $custom_logo_args[0]['flex-width'] ) ? $custom_logo_args[0]['flex-width'] : null, 'button_labels' => array( 'select' => __( 'Select logo' ), 'change' => __( 'Change logo' ), diff --git a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php index bccf1d9388..5f66023b43 100644 --- a/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php +++ b/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php @@ -477,8 +477,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { */ public function filter_wp_get_nav_menu_items( $items, $menu, $args ) { $this_item = $this->value(); - $current_nav_menu_term_id = $this_item['nav_menu_term_id']; - unset( $this_item['nav_menu_term_id'] ); + $current_nav_menu_term_id = null; + if ( isset( $this_item['nav_menu_term_id'] ) ) { + $current_nav_menu_term_id = $this_item['nav_menu_term_id']; + unset( $this_item['nav_menu_term_id'] ); + } $should_filter = ( $menu->term_id === $this->original_nav_menu_term_id @@ -493,7 +496,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { $should_remove = ( false === $this_item || - true === $this_item['_invalid'] + ( isset( $this_item['_invalid'] ) && true === $this_item['_invalid'] ) || ( $this->original_nav_menu_term_id === $menu->term_id diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 5446c16d3e..9bd989540c 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -523,7 +523,11 @@ function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) if ( ! $meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); - $meta_cache = $meta_cache[ $object_id ]; + if ( isset( $meta_cache[ $object_id ] ) ) { + $meta_cache = $meta_cache[ $object_id ]; + } else { + $meta_cache = null; + } } if ( ! $meta_key ) { diff --git a/wp-includes/rest-api/class-wp-rest-request.php b/wp-includes/rest-api/class-wp-rest-request.php index ee106b5c5a..3089547ce7 100644 --- a/wp-includes/rest-api/class-wp-rest-request.php +++ b/wp-includes/rest-api/class-wp-rest-request.php @@ -294,7 +294,9 @@ class WP_REST_Request implements ArrayAccess { * * @since 4.4.0 * - * @return array Map containing 'value' and 'parameters' keys. + * @return array|null Map containing 'value' and 'parameters' keys + * or null when no valid content-type header was + * available. */ public function get_content_type() { $value = $this->get_header( 'content-type' ); @@ -334,7 +336,7 @@ class WP_REST_Request implements ArrayAccess { $order = array(); $content_type = $this->get_content_type(); - if ( $content_type['value'] === 'application/json' ) { + if ( isset( $content_type['value'] ) && 'application/json' === $content_type['value'] ) { $order[] = 'JSON'; } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index f7f061d351..eddd76684a 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -2371,14 +2371,14 @@ function add_theme_support( $feature, ...$args ) { * Merge post types with any that already declared their support * for post thumbnails. */ - if ( is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { + if ( isset( $args[0] ) && is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { $args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) ); } break; case 'post-formats': - if ( is_array( $args[0] ) ) { + if ( isset( $args[0] ) && is_array( $args[0] ) ) { $post_formats = get_post_format_slugs(); unset( $post_formats['standard'] ); @@ -2391,7 +2391,7 @@ function add_theme_support( $feature, ...$args ) { if ( empty( $args[0] ) ) { // Build an array of types for back-compat. $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); - } elseif ( ! is_array( $args[0] ) ) { + } elseif ( ! isset( $args[0] ) || ! is_array( $args[0] ) ) { _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' ); return false; } @@ -2403,7 +2403,7 @@ function add_theme_support( $feature, ...$args ) { break; case 'custom-logo': - if ( ! is_array( $args ) ) { + if ( true === $args ) { $args = array( 0 => array() ); } $defaults = array( @@ -2426,7 +2426,7 @@ function add_theme_support( $feature, ...$args ) { return add_theme_support( 'custom-header', array( 'uploads' => true ) ); case 'custom-header': - if ( ! is_array( $args ) ) { + if ( true === $args ) { $args = array( 0 => array() ); } @@ -2516,7 +2516,7 @@ function add_theme_support( $feature, ...$args ) { break; case 'custom-background': - if ( ! is_array( $args ) ) { + if ( true === $args ) { $args = array( 0 => array() ); } diff --git a/wp-includes/user.php b/wp-includes/user.php index 3d2bf939d4..fab14519df 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -2088,7 +2088,10 @@ All at ###SITENAME### $logged_in_cookie = wp_parse_auth_cookie( '', 'logged_in' ); /** This filter is documented in wp-includes/pluggable.php */ $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false ); - $remember = ( ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ); + $remember = false; + if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) { + $remember = true; + } wp_set_auth_cookie( $ID, $remember ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 1a5e5afc20..5b5465c157 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45638'; +$wp_version = '5.3-alpha-45639'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 232b3e8ac9..4f8223fc4b 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -3113,7 +3113,7 @@ class wpdb { foreach ( $data as $col => $value ) { if ( ! empty( $value['db'] ) ) { // We're going to need to truncate by characters or bytes, depending on the length value we have. - if ( 'byte' === $value['length']['type'] ) { + if ( isset( $value['length']['type'] ) && 'byte' === $value['length']['type'] ) { // Using binary causes LEFT() to truncate by bytes. $charset = 'binary'; } else {