[wp-trac] [WordPress Trac] #41562: PHP 7.2: create_function deprecation in \Gettext_Translations class

WordPress Trac noreply at wordpress.org
Fri Aug 4 15:33:27 UTC 2017


#41562: PHP 7.2: create_function deprecation in \Gettext_Translations class
--------------------------+-----------------------------
 Reporter:  ayeshrajans   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Please see #37082 for the complement issue, and #40109 for the parent
 issue.

 Please see Sara's (who is one of the leading contributors to PHP 7.2)
 ticket #37082 for information. Her patches fixed majority of the erros for
 `create_function()`.

 I tried a new approach, similar to how `Closure` class works in modern PHP
 versions.

 `\Gettext_Translations::make_plural_form_function` function returns a
 callable, which can also be in the form of `[$object, 'method']`. Please
 review this new approach with the `\TranslationMultipleFormCallback`
 class. It still calls `eval()` because there is no other way to evaluate
 nplural formulas without a comprehensive parser.

 `create_function()` is no better than `eval()` because it is merely a thin
 wrapper around `eval()`.

 With the patch in #41457 applied, there is only 1 PHP error in Travis CI
 PHP 7.2 builds! : https://travis-ci.org/Ayesh/wordpress-
 develop/jobs/261036177#L1257

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41562>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list