【问题标题】:Warning: Trying to access array offset on value of type null in警告:尝试访问类型为 null 的值的数组偏移量
【发布时间】:2021-09-28 08:54:56
【问题描述】:

我最近在使用的 wordpress 主题中多次遇到此错误,但不幸的是,它的创建者没有维护它

警告:尝试访问类型为 null 的值的数组偏移量 /Applications/MAMP/htdocs/multivendor/wp-content/plugins/elementor/includes/base/controls-stack.php 在第 1467 行

警告:尝试访问类型为 null 的值的数组偏移量 /Applications/MAMP/htdocs/multivendor/wp-content/plugins/elementor/includes/base/controls-stack.php 在第 1469 行

这是给出错误的那一行:

public function end_controls_section() {
    $stack_name = $this->get_name();

    // Save the current section for the action.
    $current_section = $this->current_section;
    $section_id = $current_section['section'];
    $args = [
        'tab' => $current_section['tab'],
    ];

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    确保$this->current_section 返回包含“section”和“tab”元素的数组。此外,为了获得最佳实践,请始终检查数组元素是否为空。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-31
      • 2021-07-23
      • 2023-01-10
      • 2021-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多