#50899 closed defect (bug) (fixed)
PHP 8.0: change `create_function()` to closure
Reported by: | jrf | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | trivial | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch php8 has-unit-tests has-dev-note |
Focuses: | coding-standards | Cc: |
Description
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.
Attachments (1)
Change History (8)
This ticket was mentioned in PR #470 on WordPress/wordpress-develop by jrfnl.
4 years ago
#1
- Keywords has-unit-tests added
#2
@
4 years ago
- Milestone changed from Awaiting Review to 5.6
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#4
@
4 years ago
- Keywords needs-dev-note added
Adding needs-dev-note
to call this out in the PHP 8 dev note.
#5
@
4 years ago
@desrosj Not sure this actually needs to be mentioned as it is a WP Core dev only change to part of the unit tests suite. There is nothing about this which would impact userland code.
#6
@
4 years ago
@jrf My thinking here (and with a few other tickets marked needs-dev-note
related to PHP 8) is not to necessarily call out this specific change in Core, but rather note that it is something developers need to be aware of in their projects for PHP 8 support.
There were several items in the PHP 7.4 note that were similar to this ticket. Using the keyword to remember to at least mention this item in the PHP 8 note.
#7
@
4 years ago
- Keywords has-dev-note added; needs-dev-note removed
Dev note published: https://make.wordpress.org/core/2020/11/23/wordpress-and-php-8-0/
create_function()
has been removed in PHP 8.While not optimal due to the usage of
eval
, this change _should_ work and shouldn't cause any real world issues as the logic is only used within the test suite.Trac ticket: https://core.trac.wordpress.org/ticket/50899