Make WordPress Core

Opened 7 months ago

Last modified 4 months ago

#42818 new defect (bug)

i18n Tools have PHP 7.2 compatibility issues

Reported by: Otto42 Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: 4.9.1
Component: I18N Keywords: has-patch
Focuses: Cc:


From #40109 and related tickets, the use of create_function is being removed everywhere, so this should extend to the tools/i18n directory as well.

The makepot.php file still contains one use of create_function, while the not-gettexted.php file uses it twice.

These should be removed and replaced with alternatives.

Attachments (3)

42818.patch (944 bytes) - added by soulseekah 5 months ago.
42818.2.diff (4.8 KB) - added by soulseekah 5 months ago.
not-gettexted-0.mo (1.2 KB) - added by soulseekah 5 months ago.
Compiled test translation changes

Download all attachments as: .zip

Change History (8)

This ticket was mentioned in Slack in #meta by otto42. View the logs.

7 months ago

#2 @Otto42
7 months ago

  • Component changed from General to I18N
  • Keywords needs-patch added
  • Version set to 4.9.1

5 months ago

5 months ago

#3 @soulseekah
5 months ago

Attached two patches that address the issue.

The first patch takes care of makepot.php, the create_function call there simply wraps the input into curly braces, so the fix is simple - move to a function of its own.

The second patch handles the two calls inside not-gettexted.php. Their usage was is a bit tricker, relying on dynamic state, so the functionality was moved into stateful classes, and a method is returned instead of a function.

The second patch also fixes two test issues in not-gettexted:

  1. A failing case in the replace test: http vs https URLs in the expected result, seems like links to wordpress.org in PHP files were replaced to their secure counterparts but the po/mos were not touched, so the translation was not being found
  2. construct vs setUp for initialization on the test case

All tests pass with both patches applied.

Last edited 5 months ago by soulseekah (previous) (diff)

5 months ago

Compiled test translation changes

#4 @soulseekah
4 months ago

  • Keywords has-patch added; needs-patch removed

#5 @SergeyBiryukov
4 months ago

  • Milestone changed from Awaiting Review to 5.0
Note: See TracTickets for help on using tickets.