[wp-trac] [WordPress Trac] #20801: Deprecating PHP4-style constructors gracefully

WordPress Trac wp-trac at lists.automattic.com
Thu May 31 08:24:52 UTC 2012


#20801: Deprecating PHP4-style constructors gracefully
--------------------------+-----------------------------
 Reporter:  uuf6429       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  3.3.2
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 The class WP_Widget in `wp-includes/widget.php` makes use of PHP4-style
 constructor for compatibility with plugins (mostly).

 I propose two changes here:

 - A direct call to the old constructor should trigger a deprecation notice
 - The PHP4-style constructor *must* be declared after __construct()
 otherwise, an E_STRICT regarding constructor re-declaration is thrown.

 Please find a patch attached...

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20801>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list