[wp-trac] [WordPress Trac] #50899: PHP 8.0: change `create_function()` to closure

WordPress Trac noreply at wordpress.org
Tue Aug 11 18:16:06 UTC 2020


#50899: PHP 8.0: change `create_function()` to closure
------------------------------+-----------------------------
 Reporter:  jrf               |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  trivial           |   Keywords:  has-patch php8
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 `create_function()` has been removed in PHP 8.

 The only usage of `create_function()` left is in a test situation for a
 test which - due to the deprecation of `create_function()` - is being
 skipped on PHP >= 7.2.

 I propose to change the use of `create_function()` to a closure and remove
 the test skipping on PHP >= 7.2.

 While not optimal as the closure would need to use `eval`, this change
 _should_ work and shouldn't cause any real world issues as the logic is
 only used within the test suite.

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


More information about the wp-trac mailing list