Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #53816


Ignore:
Timestamp:
07/28/2021 03:40:23 PM (3 years ago)
Author:
zieladam
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #53816 – Description

    v1 v2  
    55There are a few problems there:
    66
    7 * We have multiple global variables with closely related or even roughly the same data (`$sidebars_widgets`+`$_wp_sidebars_widgets`, also `$wp_registered_sidebars`, `$sidebars_widgets`, `$wp_registered_widgets`, `$wp_registered_sidebars`). If we update one, we should also update the others for consistency. Sometimes we don't and  we run into [https://github.com/WordPress/gutenberg/issues/33335#issuecomment-879903958 undefined behaviors].
     7* We have multiple, closely related global variables (`$sidebars_widgets`+`$_wp_sidebars_widgets`, also `$wp_registered_sidebars`, `$sidebars_widgets`, `$wp_registered_widgets`, `$wp_registered_sidebars`). If we update one, we should also update the others for consistency. Sometimes we don't and  we run into [https://github.com/WordPress/gutenberg/issues/33335#issuecomment-879903958 undefined behaviors].
    88* We use a function called `retrieve_widgets` as a mean to fix any discrepancies in the stored sidebar-to-widget mapping. It's called `retrieve`, but it actually does some writing. This is a source of confusion in itself so I [https://core.trac.wordpress.org/ticket/53811 proposed renaming it].
    99* We [https://github.com/WordPress/wordpress-develop/pull/1433 we have to call retrieve_widgets in GET API endpoints] which makes it read-write, not read-only. This breaks HTTP caching and is also a [https://github.com/WordPress/gutenberg/issues/33335#issuecomment-879903958 source of bugs].