[wp-trac] [WordPress Trac] #35981: Convert WP_Widget into an abstract class

WordPress Trac noreply at wordpress.org
Tue May 17 06:07:31 UTC 2016


#35981: Convert WP_Widget into an abstract class
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:  ocean90
     Type:  enhancement                          |      Status:  reopened
 Priority:  low                                  |   Milestone:  4.6
Component:  Widgets                              |     Version:  2.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback commit        |     Focuses:
  needs-dev-note                                 |
-------------------------------------------------+-------------------------
Changes (by dd32):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Following on from the bbPress issues, I'm not certain that this is
 something we can realistically do until we require a much higher PHP
 version.

 https://3v4l.org/rq2I9 shows that under PHP 5.4+ PHP is happy for you to
 mark the parameters as optional, but that PHP 5.2 requires the function
 signature to stay exactly the same, ie:
  - `function widget( $args, $instance )` works in PHP 5.2+
  - `function widget( $args = array(), $instance = array() )` only works in
 PHP 5.4+
  - `function widget()` and `function widget( $args )` are no longer
 allowed - even if the widget has no per-widget settings.

 I'm concerned that these changes will break existing code for no obvious
 gains.

 We could mark the class as abstract only, leaving the function intact,
 however that would throw a `Strict Standards` warning in PHP 5.x, and a
 PHP Warning in PHP 7.x.

 I'm re-opening this to keep it on the radar, I don't think this
 necessarily should be immediately reverted, but I'm not confident we could
 release 4.6 and not have a bunch of sites break when we could've prevented
 it.

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


More information about the wp-trac mailing list