PHP警告:array_key_exists()期望参数2为数组

时间:2018-11-09 09:22:34

标签: php wordpress apache

我有一个十节点的proxmox集群,可以为我开发的不同网站提供托管。这些网站中有一些正在使用divi主题,并且一切正常,但是在我的apache2日志中,我仅收到其中一个警告

PHP Warning:  array_key_exists() expects parameter 2 to be array, boolean given in /var/www/anekitalia/wp-content/themes/Divi/includes/builder/functions.php on line 1876

我搜索了文件,并在该行报告了该文件

if ( ! function_exists( 'et_builder_enqueue_font' ) ) :
function et_builder_enqueue_font( $font_name ) {
global $et_fonts_queue, $et_user_fonts_queue;

$fonts = et_builder_get_fonts();
$websafe_fonts = et_builder_get_websafe_fonts();
$user_fonts = et_builder_get_custom_fonts();
$removed_fonts_mapping = et_builder_old_fonts_mapping();

/************************THE ABOVE LINE IS 1876**************************************/
      /***************************************************************/

if ( array_key_exists( $font_name, $user_fonts ) ) {
    $et_user_fonts_queue[ $font_name ] = $user_fonts[$font_name];
    return;
}

// Skip enqueueing if font name is not found. Possibly happen if support for particular font need to be dropped
if ( ! array_key_exists( $font_name, $fonts ) && ! isset( $removed_fonts_mapping[ $font_name ] ) ) {
    return;
}

// Skip enqueueing for websafe fonts
if ( array_key_exists( $font_name, $websafe_fonts ) ) {
    return;
}

if ( isset( $removed_fonts_mapping[ $font_name ] ) ){
    $font_name = $removed_fonts_mapping[ $font_name ]['parent_font'];
}
$font_character_set = $fonts[ $font_name ]['character_set'];

global $shortname;

// Force enabled subsets for existing sites once
if ( ! et_get_option( "{$shortname}_skip_font_subset_force", false ) ) {
    et_update_option( "{$shortname}_gf_enable_all_character_sets", 'on' );
    et_update_option( "{$shortname}_skip_font_subset_force", true );
}

// By default, only latin and latin-ext subsets are loaded, all available subsets can be enabled in ePanel
if ( 'false' === et_get_option( "{$shortname}_gf_enable_all_character_sets", 'false' ) ) {
    $latin_ext = '';

    if ( false !== strpos( $fonts[$font_name]['character_set'], 'latin-ext' ) ) {
        $latin_ext = ',latin-ext';
    }

    $font_character_set = "latin{$latin_ext}";
}

$font_name_slug = sprintf(
    'et-gf-%1$s',
    strtolower( str_replace( ' ', '-', $font_name ) )
);

$queued_font = array(
    'font' => sprintf( '%s:%s',
        str_replace( ' ', '+', $font_name ),
        apply_filters( 'et_builder_set_styles', $fonts[ $font_name ]['styles'], $font_name )
    ),
    'subset' => apply_filters( 'et_builder_set_character_set', $font_character_set, $font_name ),
);

// Enqueue google fonts
$et_fonts_queue[$font_name_slug] = $queued_font;
}
endif;

有人对divi主题有经验吗?我曾尝试为兼容性问题禁用所有可能的插件,但问题仍然出现。 非常感谢

0 个答案:

没有答案