[wp-trac] [WordPress Trac] #28158: WP_Widget_Factory does not validate that widget class is a WP_Widget

WordPress Trac noreply at wordpress.org
Thu May 8 15:16:16 UTC 2014


#28158: WP_Widget_Factory does not validate that widget class is a WP_Widget
---------------------------+----------------------
 Reporter:  carlalexander  |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Widgets        |     Version:  3.9
 Severity:  normal         |  Resolution:  wontfix
 Keywords:                 |     Focuses:
---------------------------+----------------------

Comment (by Denis-de-Bernardy):

 Replying to [comment:5 carlalexander]:
 > Replying to [comment:4 DrewAPicture]:
 > > I think the point is that it's understood that `WP_Widget_Factory`
 expects a `WP_Widget` object here. And in choosing not to pass one, the
 fatal that gets tossed is the notification that there is developer error.
 This not really something you'd want fail silently, imo.
 >
 > This doesn't match the behaviour in `the_widget` which does fail
 silently. If anything, the silent validation in `the_widget` is not even
 worth anything since you're going to have had a fatal error before it even
 reaches that code.

 As I recollect, the_widget(), when it was introduced, was designed in such
 a way that it wouldn't cause a fatal error when a call is left lying
 around in a theme or in php content while the plugin that introduced the
 widget is disabled. The widget factory, in contrast, should only ever get
 called when a theme or plugin introduces a new widget.

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


More information about the wp-trac mailing list