From b33b29293b8df8e8d9234669b6485e9eadbaa4cc Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Mon, 15 Jul 2019 00:11:34 +0200
Subject: [PATCH] PHP 7.4/array-access: Fix add_theme_support()
---
src/wp-includes/theme.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index f7f061d351..eddd76684a 100644
a
|
b
|
function add_theme_support( $feature, ...$args ) { |
2371 | 2371 | * Merge post types with any that already declared their support |
2372 | 2372 | * for post thumbnails. |
2373 | 2373 | */ |
2374 | | if ( is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { |
| 2374 | if ( isset( $args[0] ) && is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) { |
2375 | 2375 | $args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) ); |
2376 | 2376 | } |
2377 | 2377 | |
2378 | 2378 | break; |
2379 | 2379 | |
2380 | 2380 | case 'post-formats': |
2381 | | if ( is_array( $args[0] ) ) { |
| 2381 | if ( isset( $args[0] ) && is_array( $args[0] ) ) { |
2382 | 2382 | $post_formats = get_post_format_slugs(); |
2383 | 2383 | unset( $post_formats['standard'] ); |
2384 | 2384 | |
… |
… |
function add_theme_support( $feature, ...$args ) { |
2391 | 2391 | if ( empty( $args[0] ) ) { |
2392 | 2392 | // Build an array of types for back-compat. |
2393 | 2393 | $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); |
2394 | | } elseif ( ! is_array( $args[0] ) ) { |
| 2394 | } elseif ( ! isset( $args[0] ) || ! is_array( $args[0] ) ) { |
2395 | 2395 | _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' ); |
2396 | 2396 | return false; |
2397 | 2397 | } |
… |
… |
function add_theme_support( $feature, ...$args ) { |
2403 | 2403 | break; |
2404 | 2404 | |
2405 | 2405 | case 'custom-logo': |
2406 | | if ( ! is_array( $args ) ) { |
| 2406 | if ( true === $args ) { |
2407 | 2407 | $args = array( 0 => array() ); |
2408 | 2408 | } |
2409 | 2409 | $defaults = array( |
… |
… |
function add_theme_support( $feature, ...$args ) { |
2426 | 2426 | return add_theme_support( 'custom-header', array( 'uploads' => true ) ); |
2427 | 2427 | |
2428 | 2428 | case 'custom-header': |
2429 | | if ( ! is_array( $args ) ) { |
| 2429 | if ( true === $args ) { |
2430 | 2430 | $args = array( 0 => array() ); |
2431 | 2431 | } |
2432 | 2432 | |
… |
… |
function add_theme_support( $feature, ...$args ) { |
2516 | 2516 | break; |
2517 | 2517 | |
2518 | 2518 | case 'custom-background': |
2519 | | if ( ! is_array( $args ) ) { |
| 2519 | if ( true === $args ) { |
2520 | 2520 | $args = array( 0 => array() ); |
2521 | 2521 | } |
2522 | 2522 | |