[wp-trac] [WordPress Trac] #32480: Add _doing_it_wrong method call to WP_Widget PHP4 style constructor

WordPress Trac noreply at wordpress.org
Mon May 25 13:12:49 UTC 2015


#32480: Add _doing_it_wrong method call to WP_Widget PHP4 style constructor
------------------------------------+------------------------------
 Reporter:  welcher                 |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Widgets                 |     Version:  trunk
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by jdgrimes):

 Replying to [comment:3 dd32]:
 > > WordPress still supports PHP 5.2 so removing them is not an option
 >
 > Minor clarification; Only PHP4 requires them, they're included for
 backwards compatibility with plugins who are subclassing `WP_Widget` and
 calling `WP_Widget::WP_Widget()` directly in their constructors.

 This will continue to work for the foreseeable future of PHP (at least to
 PHP 8). I'm not saying we shouldn't deprecate these, I just want to
 clarify that calling `parent::WP_Widget()` in a child widget's constructor
 isn't going to be breaking in the future due to that RFC. It will still
 work as it does now.

 What will break is if they are defining `WP_Widget()` method as their
 widget constructor instead of `__construct()`. In PHP 7 they will get an
 `E_DEPRECATED` error, and in PHP 8 it will cease to be a constructor.

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


More information about the wp-trac mailing list