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

WordPress Trac wp-trac at lists.automattic.com
Thu May 31 08:50:39 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        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Old description:

> 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...

New description:

 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...

--

Comment (by SergeyBiryukov):

 Related: [comment:ticket:18975:10]

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


More information about the wp-trac mailing list