WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#34985 closed defect (bug) (fixed)

Remove PHP4 constructors in wp-includes/pomo/streams.php?

Reported by: andg Owned by:
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.4
Component: I18N Keywords:
Focuses: Cc:

Description

Hi,

in the wp-includes/pomo/streams.php file there's a bunch of PHP4 constructors that could generate a warning when on PHP7, since "methods with the same name as their class will not be constructors in a future version of PHP".

Should these be removed, leaving only their PHP5 counterparts?

Also related, the constructor for the POMO_CachedIntFileReader class isn't really needed, since all it does is calling its parent class' constructor.

Thoughts?

Change History (4)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to I18N

#2 @swissspidy
4 years ago

  • Keywords needs-patch added

It's an external library, see https://github.com/LeoColomb/pomo.

Though in the past lots of changes have been made to it, some have been merged upstream.

In the current version, the library uses namespaces and PHP5-style constructors only.

I think it's safe to remove the old constructors in this case, as it doesn't make maintenance any harder.

#3 @dd32
3 years ago

  • Keywords close added

I believe all of these constructors were dealt with in [32990].

Instead of removing them (which we can't really do for backwards compatibility reasons) we chose to instead ensure that a __construct() appears before the class_name() constructor. This avoids the PHP7 deprecated warnings, and even if PHP-future stops calling the class_name() methods they'll continue to work (as they now wrap the __construct() constructor).

Do there still exist any classes which don't follow the new-then-old style syntax?

#4 @ocean90
3 years ago

  • Keywords needs-patch close removed
  • Milestone changed from Awaiting Review to 4.3
  • Resolution set to fixed
  • Status changed from new to closed

See [32990].

Note: See TracTickets for help on using tickets.