Categories
WordPress

Creating default object from empty value in XXX

WordPress 3.5.1
YooTheme Subway 1.0.0
Widgetkit 1.0.5

Warning: Creating default object from empty value in C:……wp-contentpluginswidgetkitwidgetsgallerygallery.php on line 61

解决方法在原代码 中添加如下代码

[cce lang=”php”]

if (!is_object($widget )) {
$widget = new stdClass;
}

[/cce]

 

[cce lang=”php”]

public function get($id = 0) {

// get widget
if ($id) {
$widget = $this[‘widget’]->get($id);
}

if (!is_object($widget )) {
$widget = new stdClass;
}

// set defaults
foreach (array(‘id’ => 0, ‘type’ => $this->type, ‘name’ => null, ‘settings’ => array(), ‘paths’ => array(), ‘captions’ => array()) as $var => $val) {
if (!isset($widget->$var)) {
$widget->$var = $val;
}
}

return $widget;
}

[/cce]

Reference: http://wordpress.org/support/topic/buddypress-activation-outputs-warning-creating-default-object-from-empty-value

Access Date:2013/03/24

 

2013/03/25 其实这种错误是新版本的 WordPress 和 Widgetkit 1.0.5 的兼容性错误,解决的最简单方法是降级Wordpress.

Leave a Reply

Your email address will not be published. Required fields are marked *