[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
Fri Feb 21 17:24:09 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):

 Checking the value I shared, this happens because sidebar-1 is null:
 {{{
 s:9:\"sidebar-1\";N;
 }}}

 Why some widgets may get stored as null values is unknown, but if core
 properly handled unexpected data types in the `sidebars_widgets` option
 and converted any null value to an empty array before calling array
 functions, it would prevent fatals.

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


More information about the wp-trac mailing list