Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#48252 closed defect (bug) (fixed)

Consistent deprecation of PHP 4 constructors

Reported by: jrf's profile jrf Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: minor Version: 5.3
Component: General Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

While testing a new sniff for WPCS, I ran into an number of inconsistencies in the use of the `_deprecated_constructor()` function.

In particular:

  • Missing @deprecated tags in the function docblock of some PHP4 constructors.
  • Some PHP4 constructors in (external) dependencies not being marked as deprecated.

The attached patches would fix these inconsistencies.

Previous ticket: #31982

Related: #41121

Attachments (3)

48252-docs-WP_Widget-PHP4-constructor.patch (1.3 KB) - added by jrf 5 years ago.
WP_Widget(_Factory): PHP4 constructor / missing @deprecated tags
48252-docs-Twenty-Eleven-PHP-4-constructor.patch (1.0 KB) - added by jrf 5 years ago.
Twenty Eleven: mark PHP-4 constructor as deprecated As per [33086], no call to _deprecated_constructor() is added as the theme can be used by WordPress versions from before the function was introduced.
48252-Pomo-Deprecate-PHP-4-style-constructors.patch (2.9 KB) - added by jrf 5 years ago.
Pomo: Deprecate PHP-4 style constructors

Download all attachments as: .zip

Change History (13)

@jrf
5 years ago

WP_Widget(_Factory): PHP4 constructor / missing @deprecated tags

@jrf
5 years ago

Twenty Eleven: mark PHP-4 constructor as deprecated As per [33086], no call to _deprecated_constructor() is added as the theme can be used by WordPress versions from before the function was introduced.

@jrf
5 years ago

Pomo: Deprecate PHP-4 style constructors

#1 @andraganescu
5 years ago

Just noting that all these patches apply cleanly.

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
5 years ago

In 46627:

Docs: Add missing @deprecated tags to PHP 4 constructors in WP_Widget and WP_Widget_Factory().

Correct version number in _deprecated_constructor() call in WP_Widget_Factory(), see [32990].

Props jrf.
See #48252.

#4 @SergeyBiryukov
5 years ago

In 46628:

Twenty Eleven: Add missing @deprecated tag to PHP 4 constructor in Twenty_Eleven_Ephemera_Widget.

Props jrf.
See #48252.

#5 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 46629:

Docs: Add missing @deprecated tags to PHP 4 constructors in pomo/entry.php and pomo/streams.php.

Props jrf.
Fixes #48252.

#6 @SergeyBiryukov
5 years ago

In 46630:

Docs: Correct @see references for PHP 4 constructors in wp-includes/class-json.php.

See #48252, #48303.

#7 follow-up: @jrf
5 years ago

Thanks @SergeyBiryukov for getting these committed!

I just noticed that in [46629], the version numbers still refer to 5.3.0 (when I created the patches), while trunk is currently 5.4.0. Should that still be fixed ?

#8 in reply to: ↑ 7 @SergeyBiryukov
5 years ago

Replying to jrf:

I just noticed that in [46629], the version numbers still refer to 5.3.0 (when I created the patches), while trunk is currently 5.4.0. Should that still be fixed ?

Ah, good catch, missed that :) Thanks!

#9 @SergeyBiryukov
5 years ago

In 46631:

Docs: Correct version number in @deprecated tags for PHP 4 constructors in pomo/entry.php and pomo/streams.php.

Follow-up to [46629].

Props jrf.
See #48252.

#10 @SergeyBiryukov
5 years ago

In 46632:

Code Modernization: Call PHP 5 constructors in methods extending POMO_Reader.

Follow-up to [46629].

See #48252.

Note: See TracTickets for help on using tickets.