WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 7 months ago

#20801 closed defect (bug)

Deprecating PHP4-style constructors gracefully — at Version 1

Reported by: uuf6429 Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.2
Component: Widgets Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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

Change History (2)

@uuf64293 years ago

diff patch

comment:1 @SergeyBiryukov3 years ago

  • Description modified (diff)

Related: ticket:18975:10

Note: See TracTickets for help on using tickets.