[wp-trac] [WordPress Trac] #55121: classic widgets with no settings won't show up in 5.9

WordPress Trac noreply at wordpress.org
Mon Feb 14 00:07:06 UTC 2022

#55121: classic widgets with no settings won't show up in 5.9
 Reporter:  joncampbell     |       Owner:  (none)
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  Widgets         |     Version:  5.9
 Severity:  normal          |  Resolution:  invalid
 Keywords:  has-patch php8  |     Focuses:

Comment (by peterwilsoncc):

 Replying to [comment:15 jrf]:
 > @peterwilsoncc When a plugin overloads a WP native method and then
 changes the return type from the documented expected return type to
 something completely different from and incompatible with the return type
 of the original method, do you really expect WP to handle that ?

 It's complicated.

 Sometimes I do think WordPress should handle it, sometimes I do not. In
 this case, I think WordPress should handle it for a number of reasons:

 * it doesn't require a great deal of code to handle `void`, `null`, etc --
 ie, the cases in which there are reports
 * it's an unannounced backward compatibility break
 * WordPress has quite deliberately handled this use case in the past as
 seen in the earlier commit
 * The documented return type (`array`) does not match the description
 `Settings to save or bool false to cancel saving.` The source of the
 confusion comes from WP (as Scott identifies in a secondary source above).

 To reiterate from my comment above, I only think WordPress should handle
 this for widgets overloading the `WP_Widget::update()` method. WordPress
 shouldn't handle this of widgets overloading the `Widget::get_settings() `
 method as it is well outside the documented advice for developing a
 classic widget.

Ticket URL: <https://core.trac.wordpress.org/ticket/55121#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list