admin管理员组文章数量:1167180
My WordPress site is using a custom theme written by a third-party. I am getting the white screen error on my pages saying There has been a critical error on this website.
In attempt to diagnose the error I turned on debugging in the wp-config.php
file with the following:
define('WP_DEBUG', true);
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
I then checked the wp-content/debug.log
and found the following error:
PHP Fatal error: Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given in /home/.../public_html/.../wp-content/themes/.../includes/shortcodes/shortcode.tabs/_shortcode.advanced.tabs.php:301
The _shortcode.advanced.tabs.php
section of code with the error is below. Line 301 with the error is near the beginning:
extract($this->atts[ $this->id ]);
function register_tab_item($atts, $tab_content = NULL){
extract(shortcode_atts(array(
'title' => '',
'icon' => '',
'hash' => '',
), $atts));
if ( !isset($this->child[ $this->id ]) )
$this->child[ $this->id ] = 0;
$this->child[ $this->id ]++;
extract($this->atts[ $this->id ]);
$i = $this->child[ $this->id ];
$tabs_count = $this->total[ $this->id ];
$icon = cloudfw_make_icon($icon, 'ui--icon');
$hash = sanitize_html_class( $hash, "tab-". $this->id ."-{$i}" );
if ( !empty($hash) && ($hash[strlen($hash)-1] == '/') )
$hash .= '/';
if ( empty($title) && empty($icon) )
$title = "Tab {$i}";
$title = html_entity_decode(stripcslashes($title));
$this->titles[ $this->id ] .= "<li class=\"";
if ( empty($title) ) {
$this->titles[ $this->id ] .= ' empty-title';
}
$this->titles[ $this->id ] .= "\">";
if ( $title_element ) {
$this->titles[ $this->id ] .= "<$title_element>";
}
$this->titles[ $this->id ] .= "<a href=\"#{$hash}\">{$icon}{$title}</a>";
if ( $title_element ) {
$this->titles[ $this->id ] .= "</$title_element>";
}
$this->titles[ $this->id ] .= "</li>";
$tab_content = do_shortcode($tab_content);
$this->contents[ $this->id ] .= "<li class=\"hidden\">";
$this->contents[ $this->id ] .= "{$tab_content}</li>";
}
EDIT
I attempted to log more of the variables to help diagnose the error.
The variable logging is as follows:
$this->atts = $atts;
var_dump($this->id);
var_dump($this->atts);
var_dump($this->atts[ $this->id ]);
I am setting $this->atts = $atts;
because $this->atts
was empty before.
$this->id
is set to int(0)
.
$this->atts
is set to array(1) { ["title"]=> string(8) "Overview" }
.
$this->atts[ $this->id ]
is returning NULL
though. I'm not sure why this is though as I assume you can do index selection with an array in php
.
本文标签: phpUncaught TypeError extract() Argument 1 (array) must be of type arraynull given
版权声明:本文标题:php - Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1737642047a2000068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论