[wp-trac] [WordPress Trac] #39693: Fix missing assignment of widgets on theme switch
WordPress Trac
noreply at wordpress.org
Mon Aug 21 20:41:45 UTC 2017
#39693: Fix missing assignment of widgets on theme switch
-------------------------------------------------+-------------------------
Reporter: melchoyce | Owner:
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.9
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by timmydcrawford):
Tested out [[attachment:39693.3.diff]] with a switch from 2017 -> 2014 and
back. Sidebar on 2017 mapped to Primary on 2014, which felt absolutely
right. Footer 1 mapped to Content Sidebar, which seemed a bit interesting
because Footer 2 was subsequently mapped to Footer on the new theme. But,
all widgets were carried over which was fab.
Switching back to 2017 also led to all widget areas being restored to
their prior spots.
Moving to 2012 theme, which has the one sidebar, registered the logical
'Sidebar' from 2017. Switching back again restored all previous widgets,
even the ones un-used in 2012 ( footer1/2 ).
In the code, a few items:
In {{{_wp_map_sidebars()}}} should we be validating that the value of
{{{$old_sidebars_widgets}}} passed in is an array before iterating over it
in widgets.php#L1186?
On line 994 in the tests, this line struck me as a bit odd
{{{$expected_sidebars = $prev_theme_sidebars;}}} any reason to not just
assert against {{{$prev_theme_sidebars}}}?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39693#comment:75>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list