[wp-trac] [WordPress Trac] #57469: retrieve_widgets(): fatal error when a sidebar's widgets set to null (array is expected)

WordPress Trac noreply at wordpress.org
Sun Feb 16 00:36:03 UTC 2025


#57469: retrieve_widgets(): fatal error when a sidebar's widgets set to null (array
is expected)
--------------------------------------+-----------------------
 Reporter:  kesselb                   |       Owner:  (none)
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:
Component:  Widgets                   |     Version:  4.9
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------

Comment (by mtg169):

 We get various user reports of this. What I've found is that the
 `sidebar_widgets` option in the database is not a null value, but
 processing on the value during a theme change ends up looking at a null
 value. On all of the sites I've seen this happen on when changing themes,
 the value primarily only has inactive widgets. Setting the
 `sidebars_widgets` option to an empty serialized array `a:0:{}` in the
 database is another workaround.

 If reproducible data is needed, this is an option I saved from a previous
 site:



 {{{
 INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`)
 VALUES
 ('sidebars_widgets','a:6:{s:19:\"wp_inactive_widgets\";a:5:{i:0;s:6:\"text-2\";i:1;s:6:\"text-3\";i:2;s:6:\"text-4\";i:3;s:25:\"google_translate_widget-3\";i:4;s:13:\"custom_html-3\";}s:9:\"sidebar-1\";N;s:9:\"sidebar-2\";a:2:{i:0;s:18
 :\"facebook-
 likebox-3\";i:1;s:13:\"media_video-3\";}s:9:\"sidebar-3\";a:2:{i:0;s:12
 :\"blog-
 stats-3\";i:1;s:11:\"tag_cloud-3\";}s:9:\"sidebar-4\";a:2:{i:0;s:11:\"top-
 posts-3\";i:1;s:14:\"recent-
 posts-3\";}s:13:\"array_version\";i:3;}','yes');
 }}}


 Deleting any existing option and inserting that value will reproduce the
 error consistently during any theme change.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57469#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list