[wp-trac] [WordPress Trac] #39693: Fix missing assignment of widgets on theme switch
WordPress Trac
noreply at wordpress.org
Sat Sep 23 14:43:46 UTC 2017
#39693: Fix missing assignment of widgets on theme switch
----------------------------------------+------------------------
Reporter: melchoyce | Owner: obenland
Type: enhancement | Status: reviewing
Priority: high | Milestone: 4.9
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: has-unit-tests needs-patch | Focuses:
----------------------------------------+------------------------
Changes (by westonruter):
* keywords: has-patch has-unit-tests => has-unit-tests needs-patch
Comment:
@obenland I'm able to reproduce PHP warnings when switching between Twenty
Seventeen and Twenty Fifteen, see conversation at
https://wordpress.slack.com/archives/C0381N237/p1506163588000022
Here are the warnings and where they happen:
> Warning: Invalid argument supplied for foreach() in /srv/www/wordpress-
develop/public_html/src/wp-includes/widgets.php on line 1318
Line in question:
{{{
// ...for every widget we're trying to revive.
foreach ( $old_widgets as $key => $widget_id )
}}}
Also:
> Warning: array_merge(): Argument #1 is not an array in /srv/www
/wordpress-develop/public_html/src/wp-includes/widgets.php on line 1156
At:
{{{
// Find hidden/lost multi-widget instances.
$shown_widgets = call_user_func_array( 'array_merge', $sidebars_widgets );
}}}
And on the next line:
> Warning: array_diff(): Argument #2 is not an array in /srv/www
/wordpress-develop/public_html/src/wp-includes/widgets.php on line 1157
At:
{{{
$lost_widgets = array_diff( $registered_widgets_ids, $shown_widgets );
}}}
And two lines below:
> Warning: Invalid argument supplied for foreach() in /srv/www/wordpress-
develop/public_html/src/wp-includes/widgets.php on line 1159
{{{
foreach ( $lost_widgets as $key => $widget_id ) {
}}}
And lastly:
> Warning: array_merge(): Argument #1 is not an array in /srv/www
/wordpress-develop/public_html/src/wp-includes/widgets.php on line 1167
At:
{{{
$sidebars_widgets['wp_inactive_widgets'] = array_merge( $lost_widgets,
(array) $sidebars_widgets['wp_inactive_widgets'] );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39693#comment:112>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list