Make WordPress Core

Opened 3 years ago

Closed 18 months ago

Last modified 18 months ago

#42818 closed defect (bug) (wontfix)

i18n Tools have PHP 7.2 compatibility issues

Reported by: Otto42 Owned by:
Milestone: 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 3 years ago.
42818.2.diff (4.8 KB) - added by soulseekah 3 years ago.
not-gettexted-0.mo (1.2 KB) - added by soulseekah 3 years ago.
Compiled test translation changes

Download all attachments as: .zip

Change History (10)

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

3 years ago

#2 @Otto42
3 years ago

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

3 years ago

3 years ago

#3 @soulseekah
3 years 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 3 years ago by soulseekah (previous) (diff)

3 years ago

Compiled test translation changes

#4 @soulseekah
3 years ago

  • Keywords has-patch added; needs-patch removed

#5 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.0

#6 @ocean90
2 years ago

  • Keywords close added
  • Milestone changed from 5.0 to WordPress.org

Related: #45287

#7 @ocean90
18 months ago

  • Keywords close removed
  • Milestone WordPress.org deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The i18n tools have been removed in favour of the WP-CLI integration, see [45686].

Last edited 18 months ago by ocean90 (previous) (diff)
Note: See TracTickets for help on using tickets.